like to add statistics infomation ,but how to do
-
Calculate that information in your view
-
Include the results of the calculations in the context
-
Display those elements in your template.
thank for your replyă
yes, i usually do what you said . (render result in my html template)
this time , i use django admin site to show result (is so simple), but how to add statistics information make me confuse
You might be able to do what you want by overriding the ModelAdmin.changelist_view and/or the ModelAdmin.change_list_template for those models.
One aspect of this youâll want to consider is how pagination will affect this. Do you want your totals to reflect the entire table or just the list of entries on that particular page? (Thatâs a decision youâll need to make, and it may affect your code accordingly.)
But, in my opinion, youâre quickly approaching the point where youâre going beyond what the admin is designed to do. You may actually find it easier to code your own view with this data than to try to wedge your functionality into the admin. (This is especially true if youâre going to expose this to non-admin personnel. I always strongly recommend against exposing the admin as any part of your user-facing UI.)
1ăI get you point~~ is very helpful. So I 'll try to overriding ModelAdmin.changelist_view /template
2ăAbout pagination . As an administrator, they only care about the total of qualified data, not whether there are paging . -----thank for your remind
3ăI only show admin to adminstrotor not user.
My idea is to provide administrators with intuitive statistics, not just listsďź So i 'll try~~~
thanks a lot
