Saturday, December 29, 2012

Getting Access to Object in Admin Panel

After overriding list_display, I noticed that I lost access to being able to directly click on the object to view all its fields in the control panel. Hence, I needed to resort to defining return_unicode. I know that theres definitely a better way to approach it, so whats the 'Django' way of doing this?

def return_unicode(obj):
    return obj.__unicode__()

class PictureAdmin(admin.ModelAdmin):
    list_display = (return_unicode,'uploader','image','rated','approved',)

Thank You ahead of time.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/XV-EpfLbyPUJ.
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.

No comments:

Post a Comment