Opened 10 years ago

Closed 10 years ago

#23515 closed Bug (duplicate)

AUTH_USER_MODEL and admin.E108

Reported by: Wojciech Banaś Owned by: nobody
Component: contrib.admin Version: 1.7
Severity: Normal Keywords: admin AUTH_USER_MODEL
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Description of the problem:
In the administration panel you can not use relationships with the __ lookup.

I receive the following error:

<class 'admin.UserProfileAdmin'>: (admin.E108) The value of 'list_display[1]' refers to 'user__first_name', which is not a callable, an attribute of 'UserProfileAdmin', or an attribute or method on 'accounts.UserProfile'

Sample code that generates this error:

class UserProfile(models.Model):

    user = models.OneToOneField(settings.AUTH_USER_MODEL, primary_key=True)

class UserProfileAdmin(admin.ModelAdmin):

    list_display = (
        'user__id', 'user__first_name', 'user__last_name', 'user__email',)

Change History (1)

comment:1 by Tim Graham, 10 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #5863 which was closed as "won't fix". See this comment for the rationale.

Note: See TracTickets for help on using tickets.
Back to Top