Deleted serializer.py and committing final changes
This commit is contained in:
parent
eeac88a3ed
commit
ae86657fcd
3 changed files with 7 additions and 78 deletions
|
@ -1,66 +0,0 @@
|
||||||
# # Rupika Dikkala
|
|
||||||
# # January 23, 2019
|
|
||||||
# # File contains serializers needed
|
|
||||||
# # to set up API end points
|
|
||||||
#
|
|
||||||
# from rest_framework import serializers
|
|
||||||
# from . import models
|
|
||||||
#
|
|
||||||
# # serializer for reports
|
|
||||||
# class ReportSerializer(serializers.ModelSerializer):
|
|
||||||
# # user id is foreign key
|
|
||||||
# user_id = serializers.PrimaryKeyRelatedField(many=False, read_only=True)
|
|
||||||
#
|
|
||||||
# class Meta:
|
|
||||||
# fields = (
|
|
||||||
# 'user_id',
|
|
||||||
# 'title',
|
|
||||||
# 'date_created',
|
|
||||||
# # 'data_submitted',
|
|
||||||
# 'submitted',
|
|
||||||
# )
|
|
||||||
# model = models.Report
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# # section serializer
|
|
||||||
# class SectionSerializer(serializers.ModelSerializer):
|
|
||||||
# # report id foriegn key
|
|
||||||
# report_id = serializers.PrimaryKeyRelatedField(many=True, read_only=True)
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# class Meta:
|
|
||||||
# fields = (
|
|
||||||
# 'report_id',
|
|
||||||
# 'completed',
|
|
||||||
# 'title',
|
|
||||||
# 'html_description',
|
|
||||||
# 'number',
|
|
||||||
# )
|
|
||||||
# model = models.Section
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# class FieldSerializer(serializers.ModelSerializer):
|
|
||||||
# # section_id is foriegn key
|
|
||||||
# section_id = serializers.PrimaryKeyRelatedField(many=True, read_only=True)
|
|
||||||
#
|
|
||||||
# class Meta:
|
|
||||||
# fields = (
|
|
||||||
# 'section_id',
|
|
||||||
# 'label',
|
|
||||||
# 'number',
|
|
||||||
# 'type',
|
|
||||||
# 'completed',
|
|
||||||
# )
|
|
||||||
# model = models.Field
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# class DataSerializer(serializers.ModelSerializer):
|
|
||||||
# field_id = serializers.PrimaryKeyRelatedField(many=False, read_only=True)
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
|
@ -5,17 +5,13 @@ from rest_framework.urlpatterns import format_suffix_patterns
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
# path('print', views.get_reports),
|
path('report', views.report),
|
||||||
# path('print', views.get_sections),
|
|
||||||
|
|
||||||
|
|
||||||
# path('report', views.report),
|
|
||||||
path('reports', views.reports),
|
path('reports', views.reports),
|
||||||
path('report/<int:report_pk>', views.report_detail),
|
path('report/<int:report_pk>', views.report_detail),
|
||||||
# path('report/<int:report_pk>/section/<int:section_pk>', views.section),
|
path('report/<int:report_pk>/section/<int:section_pk>', views.section),
|
||||||
# path('account', views.account),
|
path('account', views.account),
|
||||||
# path('account/login', views.account_login),
|
path('account/login', views.account_login),
|
||||||
# path('account/logout', views.account_logout),
|
path('account/logout', views.account_logout),
|
||||||
]
|
]
|
||||||
|
|
||||||
urlpatterns = format_suffix_patterns(urlpatterns)
|
urlpatterns = format_suffix_patterns(urlpatterns)
|
|
@ -4,7 +4,6 @@ from rest_framework.decorators import api_view
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.http import JsonResponse
|
from django.http import JsonResponse
|
||||||
from .models import *
|
from .models import *
|
||||||
from .serializers import *
|
|
||||||
|
|
||||||
|
|
||||||
# function that prints all the reports
|
# function that prints all the reports
|
||||||
|
@ -249,9 +248,8 @@ def report_detail(request, report_pk):
|
||||||
elif request.method == 'DELETE':
|
elif request.method == 'DELETE':
|
||||||
return JsonResponse({"message": "Deleted report {0}.".format(report_pk)})
|
return JsonResponse({"message": "Deleted report {0}.".format(report_pk)})
|
||||||
|
|
||||||
# change this api view again!!
|
|
||||||
@api_view(['PUT'])
|
@api_view(['PUT'])
|
||||||
def section(report_pk, section_pk):
|
def section(request, report_pk, section_pk):
|
||||||
'''
|
'''
|
||||||
Update a section with new data.
|
Update a section with new data.
|
||||||
'''
|
'''
|
||||||
|
@ -264,6 +262,7 @@ def section(report_pk, section_pk):
|
||||||
"lowest_fare_screenshot": "image",
|
"lowest_fare_screenshot": "image",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return JsonResponse(data)
|
return JsonResponse(data)
|
||||||
|
|
||||||
@api_view(['POST'])
|
@api_view(['POST'])
|
||||||
|
|
Loading…
Reference in a new issue