Browse files

[fix bug 761263] Fix UserProfile admin search.

  • Loading branch information...
1 parent a3f3c33 commit c957841878f6486c74f8a70caa5c95a408aff0c9 @aakashhdesai aakashhdesai committed with James Socol Jun 13, 2012
Showing with 8 additions and 7 deletions.
  1. +6 −5 apps/users/admin.py
  2. +2 −2 apps/users/models.py
View
11 apps/users/admin.py
@@ -6,14 +6,15 @@
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']
+ search_fields = ['display_name', 'user__email', 'user__username',
+ 'ircname']
def has_add_permission(self, *a, **kw):
"""No one should be creating UserProfiles from the admin."""
View
4 apps/users/models.py
@@ -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):

0 comments on commit c957841

Please sign in to comment.