I'd like to make some aspects of django admin interface a bit more fluid without refreshes.
For example, I have this ReportAdmin(admin.ModelAdmin) class, which has a list_editable property that will allow user to edit the specific fields right on the list of reports view rather than clicking into each report and edit it there. 开发者_开发百科However, i'd like a button under each edited field such that when the user finishes editing a particular cell, he can just click on that button to use ajax to save that cell (if not possible, is it possible to use ajax to save the entire form instead? Just keep a list of changes and save only the intended change).
If anyone have any idea/resources on how to accomplish this, it would be much appreciated!
Jason
You can add JS code to Admin objects using its Media class. There you can probably define functions to submit changes through Ajax.
is it possible to use ajax to save the entire form instead? Just keep a list of changes and save only the intended change
Admin uses formsets to display dtata in multiple forms and formset.save()
checks for formset.changed_forms
before saving. So, only necessary db writes happen. Not every db entry is re-written.
Old question, but I found it when googling. Try https://github.com/sjrd/django-ajax-selects
精彩评论