On Thu, Apr 22, 2010 at 3:13 PM, derek <gamesb...@gmail.com> wrote:
> Thanks Tom
>
> I had thought I understood these concepts, but cannot see how to apply
> them to the User specifically.  That is why specific examples of code
> always help (apart from the ones in the manual).
>
> What would the code for "Register a different ModelAdmin for the
> auth.User class" look like?

Something like this:

from django.contrib.auth.models import User
admin.site.unregister(User)
admin.site.register(User, ReplacementUserAdmin)


>
> And can you expand further on this : "you can pass a callable as a
> field, and the callable will be called with the user instance, from
> which you can generate whatever content you like, even from the
> UserProfile."  How would this be represented in code form?
>

Like so:

def some_func(obj):
  return u"%s %s" % (obj.email, obj.get_profile().telephone)

class ReplacementUserAdmin(admin.ModelAdmin):
  list_display = (some_func, 'email')

Cheers

Tom

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

Reply via email to