In my project, I have created a model (Token) which uses a custom primary key (i.e. it uses a field defined by the model for the primary key instead of using "id"). I created an InlineAdmin class for this model and added the primary key field to InlineAdmin.readonly_fields. This InlineAdmin is added to ModelAdmin.inlines of another model.
After making these changes, it is not possible to delete a Token object from the InlineAdmin (web interface). After selecting the delete checkbox for the Token object and clicking on the "Save and continue" button (of ModelAdmin), the page reloads with the Token object still there.
I have created a simple Demo project to replicate this issue, https://github.com/pandafy/inline_admin_pk_bug.
I have done some initial debugging, and found that when the primary key is added to the InlineAdmin.readonly_fields, an HTML input element for that field is not created.
This does not occur when a model has "id" field for the primary key and the "id" field is added to InlineAdmin.readonly_fields.
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/85d9b570-d3dc-46ca-8976-8ffcff061c01n%40googlegroups.com.