From d4667691fbd88458563af3206779d109546d1dca Mon Sep 17 00:00:00 2001 From: John Eskew <jeskew@edx.org> Date: Mon, 4 Dec 2017 18:14:45 -0500 Subject: [PATCH] Convert final field from CommaSeparatedIntegerField to CharField. --- ..._archived_suggested_prices_to_charfield.py | 21 +++++++++++++++++++ common/djangoapps/course_modes/models.py | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 common/djangoapps/course_modes/migrations/0010_archived_suggested_prices_to_charfield.py diff --git a/common/djangoapps/course_modes/migrations/0010_archived_suggested_prices_to_charfield.py b/common/djangoapps/course_modes/migrations/0010_archived_suggested_prices_to_charfield.py new file mode 100644 index 00000000000..b307d064720 --- /dev/null +++ b/common/djangoapps/course_modes/migrations/0010_archived_suggested_prices_to_charfield.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import re +import django.core.validators + + +class Migration(migrations.Migration): + + dependencies = [ + ('course_modes', '0009_suggested_prices_to_charfield'), + ] + + operations = [ + migrations.AlterField( + model_name='coursemodesarchive', + name='suggested_prices', + field=models.CharField(default=b'', max_length=255, blank=True, validators=[django.core.validators.RegexValidator(re.compile('^[\\d,]+\\Z'), 'Enter only digits separated by commas.', 'invalid')]), + ), + ] diff --git a/common/djangoapps/course_modes/models.py b/common/djangoapps/course_modes/models.py index 1f74070e057..3105f1c0509 100644 --- a/common/djangoapps/course_modes/models.py +++ b/common/djangoapps/course_modes/models.py @@ -810,7 +810,8 @@ class CourseModesArchive(models.Model): min_price = models.IntegerField(default=0) # the suggested prices for this mode - suggested_prices = models.CommaSeparatedIntegerField(max_length=255, blank=True, default='') + suggested_prices = models.CharField(max_length=255, blank=True, default='', + validators=[validate_comma_separated_integer_list]) # the currency these prices are in, using lower case ISO currency codes currency = models.CharField(default="usd", max_length=8) -- GitLab