Open alinajafi321 opened 3 years ago
Hi, I use NestedField (with accept_pk_only) on DynamicFieldsMixin and i get this result:
'int' object has no attribute 'get'
Can you help me to solve this problem?
Posting a segment of code with a problem would be helpful to someone who wants to help.
I just want
class TicketingSerializer(DynamicFieldsMixin):
shift = CartAppSerializer.ShiftSerializer(read_only=True,allow_null=True, required=False)
shift_id = PKR(queryset=CartAppSerializer.Shift.objects.all(), source="shift", allow_null=True, required=False)
To
class TicketingSerializer(DynamicFieldsMixin):
shift = NestedField(ShiftSerializer, accept_pk_only=True)
For example : send request:
{
name:"new ticket"
shift:1
}
in response:
'int' object has no attribute 'get'
Try adding NestedModelSerializer to the serializer definition like this:
from django_restql.serializers import NestedModelSerializer
class TicketingSerializer(DynamicFieldsMixin, NestedModelSerializer):
If you get the same error, post the entire error trace.
Hi, I use NestedField (with accept_pk_only) on DynamicFieldsMixin and i get this result:
'int' object has no attribute 'get'
Can you help me to solve this problem?