Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MOOC packages by hacklab
django-courses
Commits
c78ea6dd
Commit
c78ea6dd
authored
Apr 13, 2021
by
Matheus Miranda
Browse files
Merge branch 'develop' into 'master'
Update language field See merge request
!45
parents
3a5c476a
485a5611
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
14 deletions
+46
-14
courses/migrations/0023_auto_20210412_1852.py
courses/migrations/0023_auto_20210412_1852.py
+35
-0
courses/models.py
courses/models.py
+9
-12
courses/serializers.py
courses/serializers.py
+1
-1
courses/translation.py
courses/translation.py
+1
-1
No files found.
courses/migrations/0023_auto_20210412_1852.py
0 → 100644
View file @
c78ea6dd
# 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
),
),
]
courses/models.py
View file @
c78ea6dd
...
...
@@ -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'
),
...
...
courses/serializers.py
View file @
c78ea6dd
...
...
@@ -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'
,
'lang
uage
'
,
'course_load'
)
'informations'
,
'description'
,
'lang'
,
'course_load'
)
@
staticmethod
def
get_home_thumbnail_url
(
obj
):
...
...
courses/translation.py
View file @
c78ea6dd
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment