Closed junwenwaynepeng closed 1 year ago
I find a solution here. However, I stil conisider this is a bug that needs to be fixed because I want to sort the inline by the name.
sortable_field_name
is exclusively for keeping track of the order while drag-and-drop sorting. If you want the results to be sorted by name then you can accomplish that by omitting the sortable_field_name
and adding the ordering
to the model's class Meta
. Though that will only sort entries on load that have already been saved, there wouldn't actually be a way of dynamically sorting by the name while the names are being added and edited.
My models.py:
and my admin.py
I have tried the django's original TabularInline, and everything works fine. However, when I change the django's TabularInline to nested_admin's Tabular inline, the following error arises:
ValueError: Cannot assign "0": "Folder.name" must be a "FolderLabel" instance.
The bug is even when I choose an object in a foreignkey field of an inline form and send Post request, the information isn't carried along.
I could provide more detail information if you need. However, I believe this is a bug in nested_admin. Hope this won't be too hard to fix.