Commit 4969aec5 by Clinton Blackburn Committed by GitHub

Removed the Program.category field (#309)

parent cae32af5
......@@ -49,7 +49,6 @@ COURSE_RUN_SEARCH_FIELDS = (
)
PROGRAM_FACET_FIELD_OPTIONS = {
'category': {},
'status': {},
'type': {},
'seat_types': {},
......
......@@ -66,7 +66,7 @@ class CourseRunAdmin(admin.ModelAdmin):
class ProgramAdmin(admin.ModelAdmin):
form = ProgramAdminForm
inlines = [FaqsInline, IndividualEndorsementInline, CorporateEndorsementsInline]
list_display = ('id', 'uuid', 'title', 'category', 'type', 'partner', 'status',)
list_display = ('id', 'uuid', 'title', 'type', 'partner', 'status',)
list_filter = ('partner', 'type', 'status',)
ordering = ('uuid', 'title', 'status')
readonly_fields = ('uuid', 'custom_course_runs_display', 'excluded_course_runs',)
......
......@@ -10,9 +10,7 @@ from course_discovery.apps.course_metadata.models import Program, CourseRun
class ProgramAdminForm(forms.ModelForm):
class Meta:
model = Program
exclude = (
'category',
)
fields = '__all__'
widgets = {
'courses': autocomplete.ModelSelect2Multiple(
url='admin_metadata:course-autocomplete',
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('course_metadata', '0024_auto_20160901_1426'),
]
operations = [
migrations.RemoveField(
model_name='program',
name='category',
),
]
......@@ -599,8 +599,6 @@ class Program(TimeStampedModel):
help_text=_('The user-facing display title for this Program.'), max_length=255, unique=True)
subtitle = models.CharField(
help_text=_('A brief, descriptive subtitle for the Program.'), max_length=255, blank=True)
# TODO Remove category in favor of type
category = models.CharField(help_text=_('The category / type of Program.'), max_length=32)
type = models.ForeignKey(ProgramType, null=True, blank=True)
status = models.CharField(
help_text=_('The lifecycle status of this Program.'), max_length=24, null=False, blank=False, db_index=True,
......
......@@ -4,12 +4,9 @@ from __future__ import unicode_literals
from django.db import migrations
def set_program_types(apps, schema_editor):
Program = apps.get_model('course_metadata', 'Program')
ProgramType = apps.get_model('course_metadata', 'ProgramType')
xseries_type = ProgramType.objects.get(name='XSeries')
Program.objects.filter(category__iexact='xseries').update(type=xseries_type)
# NOTE (CCB): This migration is intentionally blank to avoid ghost migrations in production.
# The category field has been removed from the Program model. When we do squash migrations, this migration
# should be removed.
class Migration(migrations.Migration):
......@@ -18,5 +15,4 @@ class Migration(migrations.Migration):
]
operations = [
migrations.RunPython(set_program_types, reverse_code=migrations.RunPython.noop)
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment