Commit c78ea6dd authored by Matheus Miranda's avatar Matheus Miranda

Merge branch 'develop' into 'master'

Update language field

See merge request !45
parents 3a5c476a 485a5611
# 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 _
from django.utils import timezone
from django.contrib.auth.models import Group
from django.contrib.staticfiles.storage import staticfiles_storage
from django.contrib.postgres.fields import ArrayField
from django.template import Template, Context
from django.contrib.contenttypes.fields import GenericRelation
from django.conf import settings
......@@ -49,13 +50,6 @@ class Course(models.Model):
('draft', _('Draft')),
('published', _('Published')),
)
LANGUAGES = (
('english', _('English')),
('portuguese', _('Portuguese')),
('spanish', _('Spanish')),
)
slug = models.SlugField(
_('Slug'),
max_length=255,
......@@ -115,11 +109,14 @@ class Course(models.Model):
default=STATES[0][0],
max_length=64,
)
language = models.CharField(
_('Language'),
choices=LANGUAGES,
default=LANGUAGES[0][0],
max_length=64,
lang = ArrayField(
models.CharField(
choices=settings.LANGUAGES,
blank=True,
default=settings.LANGUAGES[0],
max_length=64),
blank=True,
null=True,
)
thumbnail = models.ImageField(
_('Thumbnail'),
......
......@@ -46,7 +46,7 @@ class CourseSerializer(serializers.ModelSerializer):
'start_date', 'home_published', 'authors_names', 'has_started',
'min_percent_to_complete', 'is_user_assistant', 'is_user_coordinator',
'is_assistant_or_coordinator', 'professors', 'track', 'forum_id',
'informations', 'description', 'language', 'course_load')
'informations', 'description', 'lang', 'course_load')
@staticmethod
def get_home_thumbnail_url(obj):
......
......@@ -7,7 +7,7 @@ class CourseTranslationOptions(TranslationOptions):
fields = ('slug', 'name', 'intro_video', 'application',
'requirement', 'abstract', 'structure', 'workload',
'course_load', 'pronatec', 'thumbnail', 'home_thumbnail',
'min_percent_to_complete', 'informations', 'description', 'language')
'min_percent_to_complete', 'informations', 'description')
@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