Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
Clarify where data in UserProfileAdmin comes from.
Browse files Browse the repository at this point in the history
Makes callables on the UserProfile model look distinct from typical
double-underscore lookups. Different options on ModelAdmin behave
differently, so this should make it clearer which option is using which
data source.
  • Loading branch information
James Socol committed Jun 14, 2012
1 parent c957841 commit 079696b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions apps/users/admin.py
Expand Up @@ -6,12 +6,12 @@


class UserProfileAdmin(AdminImageMixin, admin.ModelAdmin):
fields = ['user', 'user__email', 'display_name', 'photo', 'ircname',
fields = ['user', 'user_email', 'display_name', 'photo', 'ircname',
'is_vouched', 'vouched_by', 'bio', 'website', 'groups', 'skills']
list_display = ['display_name', 'user__email', 'user__username', 'ircname',
list_display = ['display_name', 'user_email', 'user_username', 'ircname',
'is_vouched', 'vouched_by']
list_display_links = ['display_name', 'user__email', 'user__username']
readonly_fields = ['user', 'user__email']
list_display_links = ['display_name', 'user_email', 'user_username']
readonly_fields = ['user', 'user_email']
save_on_top = True
search_fields = ['display_name', 'user__email', 'user__username',
'ircname']
Expand Down
4 changes: 2 additions & 2 deletions apps/users/models.py
Expand Up @@ -75,10 +75,10 @@ def __unicode__(self):
def get_absolute_url(self):
return reverse('profile', args=[self.user.username])

def user__email(self):
def user_email(self):
return self.user.email

def user__username(self):
def user_username(self):
return self.user.username

def anonymize(self):
Expand Down

0 comments on commit 079696b

Please sign in to comment.