Skip to content
Snippets Groups Projects
Commit 18495e97 authored by David Ormsbee's avatar David Ormsbee
Browse files

Add search, sort, and slug dropdown to Course Modes admin.

parent fe40fa6d
No related merge requests found
......@@ -13,6 +13,13 @@ class CourseModeForm(forms.ModelForm):
class Meta:
model = CourseMode
COURSE_MODE_SLUG_CHOICES = (
[(CourseMode.DEFAULT_MODE_SLUG, CourseMode.DEFAULT_MODE_SLUG)] +
[(mode_slug, mode_slug) for mode_slug in CourseMode.VERIFIED_MODES]
)
mode_slug = forms.ChoiceField(choices=COURSE_MODE_SLUG_CHOICES)
def clean_course_id(self):
course_id = self.cleaned_data['course_id']
try:
......@@ -31,6 +38,10 @@ class CourseModeForm(forms.ModelForm):
class CourseModeAdmin(admin.ModelAdmin):
form = CourseModeForm
search_fields = ('course_id',)
list_display = (
'id', 'course_id', 'mode_slug', 'mode_display_name', 'min_price',
'suggested_prices', 'currency', 'expiration_date', 'expiration_datetime'
)
admin.site.register(CourseMode, CourseModeAdmin)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment