Skip to content

Commit

Permalink
ECOM-5344
Browse files Browse the repository at this point in the history
Type is required field for the admin. Otherwise it throws errors during adding the new program using django-admin.
  • Loading branch information
awais786 committed Aug 24, 2016
1 parent 6e9fc9c commit df2af24
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion course_discovery/apps/course_metadata/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class ProgramAdmin(admin.ModelAdmin):

# ordering the field display on admin page.
fields = (
'title', 'status', 'banner_image_url', 'card_image_url', 'overview', 'video',
'title', 'status', 'type', 'banner_image_url', 'card_image_url', 'overview', 'video',
)
fields += (
'courses', 'course_runs', 'excluded_course_runs'
Expand Down
6 changes: 5 additions & 1 deletion course_discovery/apps/course_metadata/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ class ProgramAdminForm(forms.ModelForm):
class Meta:
model = Program
exclude = (
'subtitle', 'category', 'type', 'marketing_slug', 'weeks_to_complete',
'subtitle', 'category', 'marketing_slug', 'weeks_to_complete',
'min_hours_effort_per_week', 'max_hours_effort_per_week',
'authoring_organizations',
)

def __init__(self, *args, **kwargs):
super(ProgramAdminForm, self).__init__(*args, **kwargs)
self.fields['type'].required = True


class CourseRunSelectionForm(forms.ModelForm):

Expand Down

0 comments on commit df2af24

Please sign in to comment.