1👍
✅
Ouch. I’m sorry for this question.
Somebody created pk field for this table as integer with default value from sequence (without owning this sequence).
Django performs pk selection as SELECT CURRVAL(pg_get_serial_sequence('tablename','id'))
. But pg_get_serial_sequence returns Null.
select … returning id;`. I’ll try to fix the database.
I don't know why django-rest-framework doesn't perform
1👍
I think this serializer class should work:
class PlatformSerializer(serializers.ModelSerializer):
class Meta:
model=Platform
By default, all the model fields on the class will be mapped to corresponding serializer fields.
Source:stackexchange.com