Permalink
Browse files

Clarify where data in UserProfileAdmin comes from.

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...
1 parent dafc462 commit 2ea18da48ec6a5502215e0b58e700a4da8dfe03e James Socol committed Jun 14, 2012
Showing with 6 additions and 6 deletions.
  1. +4 −4 apps/users/admin.py
  2. +2 −2 apps/users/models.py
View
@@ -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']
View
@@ -62,10 +62,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):

0 comments on commit 2ea18da

Please sign in to comment.