fix errors

This commit is contained in:
Rupika 2019-01-23 18:18:19 -08:00
parent fe516ec96b
commit 496ec5626e

View file

@ -8,26 +8,15 @@ from . import models
# serializer for reports # serializer for reports
class ReportSerializer(serializers.ModelSerializer): class ReportSerializer(serializers.ModelSerializer):
# user id is foreign key...? fix this # user id is foreign key
user_id = serializers.PrimaryKeyRelatedField(many=False, read_only=True) user_id = serializers.PrimaryKeyRelatedField(many=False, read_only=True)
class Meta: class Meta:
fields = list()
model = models.Report
if model.submitted:
fields = (
'user_id',
'title',
'date_created',
'data_submitted',
'submitted',
)
else:
fields = ( fields = (
'user_id', 'user_id',
'title', 'title',
'date_created', 'date_created',
# 'data_submitted',
'submitted', 'submitted',
) )