Skip to content

Commit

Permalink
Fixed admin issues
Browse files Browse the repository at this point in the history
- Using raw ID field for user fields for enrollment and user profile admin
- Including user data in enrollment admin queryset
  • Loading branch information
clintonb committed Nov 6, 2015
1 parent 222bdd9 commit afd682e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions common/djangoapps/student/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,20 @@ class CourseEnrollmentAdmin(admin.ModelAdmin):
""" Admin interface for the CourseEnrollment model. """
list_display = ('id', 'course_id', 'mode', 'user', 'is_active',)
list_filter = ('mode', 'is_active',)
raw_id_fields = ('user',)
search_fields = ('course_id', 'mode', 'user__username',)

def queryset(self, request):
return super(CourseEnrollmentAdmin, self).queryset(request).select_related('user')

class Meta(object):
model = CourseEnrollment


class UserProfileAdmin(admin.ModelAdmin):
""" Admin interface for UserProfile model. """
list_display = ('user', 'name',)
raw_id_fields = ('user',)
search_fields = ('user__username', 'user__first_name', 'user__last_name', 'user__email', 'name',)

def get_readonly_fields(self, request, obj=None):
Expand Down

0 comments on commit afd682e

Please sign in to comment.