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
3a5c476a
Commit
3a5c476a
authored
3 years ago
by
Matheus Miranda
Browse files
Options
Download
Plain Diff
Merge branch 'develop' into 'master'
Add new translated fields See merge request
!44
parents
6d0eeb46
491056cb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
2 deletions
+96
-2
courses/migrations/0022_auto_20210412_1110.py
courses/migrations/0022_auto_20210412_1110.py
+73
-0
courses/models.py
courses/models.py
+20
-0
courses/serializers.py
courses/serializers.py
+2
-1
courses/translation.py
courses/translation.py
+1
-1
No files found.
courses/migrations/0022_auto_20210412_1110.py
0 → 100644
View file @
3a5c476a
# Generated by Django 2.2.19 on 2021-04-12 14:10
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'courses'
,
'0021_auto_20210323_1414'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'course'
,
name
=
'description'
,
field
=
models
.
TextField
(
blank
=
True
,
verbose_name
=
'Description'
),
),
migrations
.
AddField
(
model_name
=
'course'
,
name
=
'description_en'
,
field
=
models
.
TextField
(
blank
=
True
,
null
=
True
,
verbose_name
=
'Description'
),
),
migrations
.
AddField
(
model_name
=
'course'
,
name
=
'description_es'
,
field
=
models
.
TextField
(
blank
=
True
,
null
=
True
,
verbose_name
=
'Description'
),
),
migrations
.
AddField
(
model_name
=
'course'
,
name
=
'description_pt_br'
,
field
=
models
.
TextField
(
blank
=
True
,
null
=
True
,
verbose_name
=
'Description'
),
),
migrations
.
AddField
(
model_name
=
'course'
,
name
=
'informations'
,
field
=
models
.
TextField
(
blank
=
True
,
verbose_name
=
'Informations'
),
),
migrations
.
AddField
(
model_name
=
'course'
,
name
=
'informations_en'
,
field
=
models
.
TextField
(
blank
=
True
,
null
=
True
,
verbose_name
=
'Informations'
),
),
migrations
.
AddField
(
model_name
=
'course'
,
name
=
'informations_es'
,
field
=
models
.
TextField
(
blank
=
True
,
null
=
True
,
verbose_name
=
'Informations'
),
),
migrations
.
AddField
(
model_name
=
'course'
,
name
=
'informations_pt_br'
,
field
=
models
.
TextField
(
blank
=
True
,
null
=
True
,
verbose_name
=
'Informations'
),
),
migrations
.
AddField
(
model_name
=
'course'
,
name
=
'language'
,
field
=
models
.
CharField
(
choices
=
[(
'english'
,
'English'
),
(
'portuguese'
,
'Portuguese'
),
(
'spanish'
,
'Spanish'
)],
default
=
'english'
,
max_length
=
64
,
verbose_name
=
'Language'
),
),
migrations
.
AddField
(
model_name
=
'course'
,
name
=
'language_en'
,
field
=
models
.
CharField
(
choices
=
[(
'english'
,
'English'
),
(
'portuguese'
,
'Portuguese'
),
(
'spanish'
,
'Spanish'
)],
default
=
'english'
,
max_length
=
64
,
null
=
True
,
verbose_name
=
'Language'
),
),
migrations
.
AddField
(
model_name
=
'course'
,
name
=
'language_es'
,
field
=
models
.
CharField
(
choices
=
[(
'english'
,
'English'
),
(
'portuguese'
,
'Portuguese'
),
(
'spanish'
,
'Spanish'
)],
default
=
'english'
,
max_length
=
64
,
null
=
True
,
verbose_name
=
'Language'
),
),
migrations
.
AddField
(
model_name
=
'course'
,
name
=
'language_pt_br'
,
field
=
models
.
CharField
(
choices
=
[(
'english'
,
'English'
),
(
'portuguese'
,
'Portuguese'
),
(
'spanish'
,
'Spanish'
)],
default
=
'english'
,
max_length
=
64
,
null
=
True
,
verbose_name
=
'Language'
),
),
]
This diff is collapsed.
Click to expand it.
courses/models.py
View file @
3a5c476a
...
@@ -50,6 +50,12 @@ class Course(models.Model):
...
@@ -50,6 +50,12 @@ class Course(models.Model):
(
'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
,
...
@@ -79,6 +85,14 @@ class Course(models.Model):
...
@@ -79,6 +85,14 @@ class Course(models.Model):
_
(
'Abstract'
),
_
(
'Abstract'
),
blank
=
True
,
blank
=
True
,
)
)
informations
=
models
.
TextField
(
_
(
'Informations'
),
blank
=
True
,
)
description
=
models
.
TextField
(
_
(
'Description'
),
blank
=
True
,
)
structure
=
models
.
TextField
(
structure
=
models
.
TextField
(
_
(
'Structure'
),
_
(
'Structure'
),
blank
=
True
,
blank
=
True
,
...
@@ -101,6 +115,12 @@ class Course(models.Model):
...
@@ -101,6 +115,12 @@ class Course(models.Model):
default
=
STATES
[
0
][
0
],
default
=
STATES
[
0
][
0
],
max_length
=
64
,
max_length
=
64
,
)
)
language
=
models
.
CharField
(
_
(
'Language'
),
choices
=
LANGUAGES
,
default
=
LANGUAGES
[
0
][
0
],
max_length
=
64
,
)
thumbnail
=
models
.
ImageField
(
thumbnail
=
models
.
ImageField
(
_
(
'Thumbnail'
),
_
(
'Thumbnail'
),
upload_to
=
hash_name
(
'course_thumbnails'
,
'name'
),
upload_to
=
hash_name
(
'course_thumbnails'
,
'name'
),
...
...
This diff is collapsed.
Click to expand it.
courses/serializers.py
View file @
3a5c476a
...
@@ -45,7 +45,8 @@ class CourseSerializer(serializers.ModelSerializer):
...
@@ -45,7 +45,8 @@ class CourseSerializer(serializers.ModelSerializer):
'thumbnail_url'
,
'home_thumbnail_url'
,
'home_position'
,
'thumbnail_url'
,
'home_thumbnail_url'
,
'home_position'
,
'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'
)
@
staticmethod
@
staticmethod
def
get_home_thumbnail_url
(
obj
):
def
get_home_thumbnail_url
(
obj
):
...
...
This diff is collapsed.
Click to expand it.
courses/translation.py
View file @
3a5c476a
...
@@ -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'
)
'min_percent_to_complete'
,
'informations'
,
'description'
,
'language'
)
@
register
(
Lesson
)
@
register
(
Lesson
)
...
...
This diff is collapsed.
Click to expand it.
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