Tag Archives: Django

Django hook URL of a changelist view

In django admin site, there is a changelist view, e.g. /myhworks/work/task/. The admin site is registered as class TaskAdmin( admin.ModelAdmin ): list_display = [ "project", "title", "user", "works", "time", "finished" ] list_filter = [ "finished", "user", "project" ] inlines = … Continue reading

Posted in Django | Tagged , , , | 3 Comments

automatically add addition model attributes which will be used in list_display in django admin site

Example: def str2function( fname, fbody ): “”"get the function object from fbody and fname “”" exec( fbody ) fn = locals()[ fname ] return fn def get_german_display_function( name ): “”"generate fname and fbody from field name “”" fname = “get_%s_german_display” … Continue reading

Posted in Django | Tagged , , , , , | 2 Comments

Add new action in changelist in Django

Django ship a default action “Delete selected <objects>”, how can we add a new action? It is easy to do that. All you need to do are in admin.py where the model admins are registered. First write your action handler … Continue reading

Posted in Django | Tagged , | 3 Comments
Page 1 of 912345...Last »