-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using ajax_datatable for admin template #98
Comments
Hello @michaeldacanay, thanks for the interesting question. When using DataTables.net in Ajax mode, two views are needed: the first "traditional" for rendering the HTML table, and the second "solicited via ajax" to react to user prompts. Wanting to use django-ajax-datatable in the context of a Django admin changelist, I think it is necessary to override "change_list.html" and there (1) insert an HTML table and (2) invoke AjaxDatatableViewUtils.initialize_table() to associate to that HTML table a suitable AjaxDatatableView-derived view. This app was been developed mainly to have a listing tool in the frontend, so I never had the need to use it in Django admin, but I think it should work. |
Hi @morlandi, thank you so much for your reply. So far, I have been able to figure out that |
I would rather override The template doesn't need to know where the AjaxDatatableView-derived view lives; just provide a url to the latter, and refer to the url in the template |
Thank you @morlandi for pointing me in the right direction. I am now using
In my MyModelAdmin in
This is my current code. I have the |
I believe the table from
|
The example_minimal code was very useful in understanding how ajax_datatable works. However, how would I use ajax_datatable to replace the default admin table (overriding the admin template)? It is a bit unclear to me. It seems that ajax_datatable requires a urls.py / views.py / ajax_datatable_views.py structure. However, most documentation overriding admin template seems to just override the html file.
thank you for your time!
The text was updated successfully, but these errors were encountered: