50👍
✅
Read the DRF docs here.
In version 2.x a serializer class could sometimes automatically determine the queryset argument if a ModelSerializer class was being used.
This behavior is now replaced with always using an explicit queryset argument for writable relational fields.
You are just using a newer version of DRF than the authors of the code used, so you’ll need to either use a lower version or fix the code.
In serializers.py there’s this line:
assigned = serializers.SlugRelatedField(slug_field=User.USERNAME_FIELD, required=False)
You need to either add read_only=True
or queryset=User.objects.all()
- [Django]-Transaction managed block ended with pending COMMIT/ROLLBACK
- [Django]-What does request.method == "POST" mean in Django?
- [Django]-Django templates: Best practice for translating text block with HTML in it
-3👍
you need remove RelatedField from your serializers it is no more supported by django.in my case it worked.
- [Django]-In a Django QuerySet, how to filter for "not exists" in a many-to-one relationship
- [Django]-Sending images using Http Post
- [Django]-Resize fields in Django Admin
Source:stackexchange.com