1👍
✅
Actually I’ve solved the problem.
On the model, if you need to define the column name, as I did, don’t use IntegerField on a primary key.
Do it like this:
system = models.AutoField(primary_key=True, db_column="system_id")
The way tastypie looks after the newly created object, it needs the autoincrement defined on the model, so it knows the last created ID.
Good find, hope it helps someone someday.
1👍
You have to set in the meta class of the Resource:
always_return_data = True
And try your unique id field to be with default name id not service.
- [Answered ]-Lambda – 'QuerySet' object has no attribute 'xxx'
- [Answered ]-Writing Django messaging to log files as well
- [Answered ]-Selected value of ChoiceField created by ForeignKey is not displayed in form
- [Answered ]-Django-rest-framework and uploading images
- [Answered ]-Access to user's email
Source:stackexchange.com