AssertionError: The field ' ' was declared on serializer ' ', but has not been included in the 'fields' option

You need to modify your doctor field name to be the proper case:

fields = ('id' , 'name' , 'gender' , 'breed' , 'adoption' , 'vaccines', 'doctor')

Doctor is currently, incorrectly uppercase.


Whatever field you will define in Serializer, you need to put it in the meta class fields. If you don't mention you will get the error.

builtins.AssertionError AssertionError: The field 'abc' was declared on serializer ABCSerializer, but has not been included in the 'fields' option.

So in your case you have defined doctor field in serializer so you meta fields should have this doctor field. It is case-sensitive. So you will have to use doctor instead of Doctor.

class AnimalSerialiser(serializers.HyperlinkedModelSerializer):
doctor = DoctorSerealiser()


class Meta:
    model = Animal
    fields = ('id' , 'name' , 'gender' , 'breed' , 'adoption' , 'vaccines', 'doctor')