Commit 485a5611 authored by Glaucia S. Santos's avatar Glaucia S. Santos
Browse files

Update language field

parent 491056cb
# Generated by Django 2.2.20 on 2021-04-12 21:52
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('courses', '0022_auto_20210412_1110'),
]
operations = [
migrations.RemoveField(
model_name='course',
name='language',
),
migrations.RemoveField(
model_name='course',
name='language_en',
),
migrations.RemoveField(
model_name='course',
name='language_es',
),
migrations.RemoveField(
model_name='course',
name='language_pt_br',
),
migrations.AddField(
model_name='course',
name='lang',
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, choices=[('en', 'English'), ('pt-br', 'Portuguese'), ('es', 'Spanish')], default=('en', 'English'), max_length=64), blank=True, null=True, size=None),
),
]
...@@ -9,6 +9,7 @@ from django.utils.translation import ugettext_lazy as _ ...@@ -9,6 +9,7 @@ from django.utils.translation import ugettext_lazy as _
from django.utils import timezone from django.utils import timezone
from django.contrib.auth.models import Group from django.contrib.auth.models import Group
from django.contrib.staticfiles.storage import staticfiles_storage from django.contrib.staticfiles.storage import staticfiles_storage
from django.contrib.postgres.fields import ArrayField
from django.template import Template, Context from django.template import Template, Context
from django.contrib.contenttypes.fields import GenericRelation from django.contrib.contenttypes.fields import GenericRelation
from django.conf import settings from django.conf import settings
...@@ -49,13 +50,6 @@ class Course(models.Model): ...@@ -49,13 +50,6 @@ class Course(models.Model):
('draft', _('Draft')), ('draft', _('Draft')),
('published', _('Published')), ('published', _('Published')),
) )
LANGUAGES = (
('english', _('English')),
('portuguese', _('Portuguese')),
('spanish', _('Spanish')),
)
slug = models.SlugField( slug = models.SlugField(
_('Slug'), _('Slug'),
max_length=255, max_length=255,
...@@ -115,11 +109,14 @@ class Course(models.Model): ...@@ -115,11 +109,14 @@ class Course(models.Model):
default=STATES[0][0], default=STATES[0][0],
max_length=64, max_length=64,
) )
language = models.CharField( lang = ArrayField(
_('Language'), models.CharField(
choices=LANGUAGES, choices=settings.LANGUAGES,
default=LANGUAGES[0][0], blank=True,
max_length=64, default=settings.LANGUAGES[0],
max_length=64),
blank=True,
null=True,
) )
thumbnail = models.ImageField( thumbnail = models.ImageField(
_('Thumbnail'), _('Thumbnail'),
......
...@@ -46,7 +46,7 @@ class CourseSerializer(serializers.ModelSerializer): ...@@ -46,7 +46,7 @@ class CourseSerializer(serializers.ModelSerializer):
'start_date', 'home_published', 'authors_names', 'has_started', 'start_date', 'home_published', 'authors_names', 'has_started',
'min_percent_to_complete', 'is_user_assistant', 'is_user_coordinator', 'min_percent_to_complete', 'is_user_assistant', 'is_user_coordinator',
'is_assistant_or_coordinator', 'professors', 'track', 'forum_id', 'is_assistant_or_coordinator', 'professors', 'track', 'forum_id',
'informations', 'description', 'language', 'course_load') 'informations', 'description', 'lang', 'course_load')
@staticmethod @staticmethod
def get_home_thumbnail_url(obj): def get_home_thumbnail_url(obj):
......
...@@ -7,7 +7,7 @@ class CourseTranslationOptions(TranslationOptions): ...@@ -7,7 +7,7 @@ class CourseTranslationOptions(TranslationOptions):
fields = ('slug', 'name', 'intro_video', 'application', fields = ('slug', 'name', 'intro_video', 'application',
'requirement', 'abstract', 'structure', 'workload', 'requirement', 'abstract', 'structure', 'workload',
'course_load', 'pronatec', 'thumbnail', 'home_thumbnail', 'course_load', 'pronatec', 'thumbnail', 'home_thumbnail',
'min_percent_to_complete', 'informations', 'description', 'language') 'min_percent_to_complete', 'informations', 'description')
@register(Lesson) @register(Lesson)
......
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