Tuesday, October 16, 2012

Better feedback for admin users

I am starting to customise the admin classes for my models so that I can provide extra feedback to the user.

For example I want to report - in the admin page - useful information about how the system will interpret the current state of the object being edited.

I'm doing this by using readonly_fields, that contain the output of method on the ModelAdmin class, a bit like this:

class PersonAdmin(ModelAdmin):
readonly_fields = ['check_address',]

def check_address(self, instance):
return instance.get_full_address or "<span class='errors'>Warning: I am unable to work out an address for this person.</span>"

(the actual examples are rather more complex, but this is the idea).

Does a more elegant way of doing this exist, either in Django's core already, or using some package that makes it easier?

Thanks,

Daniele

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate