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
245ae8b3
Commit
245ae8b3
authored
Jul 30, 2021
by
Matheus Miranda
Browse files
Merge branch 'develop' into 'master'
Update translation for Video model See merge request
!77
parents
a06a05b7
620c8e37
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
157 additions
and
17 deletions
+157
-17
courses/certification/migrations/0008_auto_20210730_1110.py
courses/certification/migrations/0008_auto_20210730_1110.py
+43
-0
courses/certification/models.py
courses/certification/models.py
+16
-3
courses/certification/serializers.py
courses/certification/serializers.py
+11
-3
courses/certification/views.py
courses/certification/views.py
+1
-8
courses/migrations/0031_auto_20210730_1115.py
courses/migrations/0031_auto_20210730_1115.py
+83
-0
courses/translation.py
courses/translation.py
+2
-2
courses/videos/serializers.py
courses/videos/serializers.py
+1
-1
No files found.
courses/certification/migrations/0008_auto_20210730_1110.py
0 → 100644
View file @
245ae8b3
# Generated by Django 2.2.24 on 2021-07-30 14:10
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'certification'
,
'0007_auto_20210526_1217'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'certificatetemplate'
,
name
=
'background_image'
,
field
=
models
.
ImageField
(
blank
=
True
,
null
=
True
,
upload_to
=
'certificates_files'
,
verbose_name
=
'Background image'
),
),
migrations
.
AddField
(
model_name
=
'certificatetemplate'
,
name
=
'display_background_image'
,
field
=
models
.
BooleanField
(
default
=
True
,
verbose_name
=
'Display background image'
),
),
migrations
.
AlterField
(
model_name
=
'certificatetemplate'
,
name
=
'text'
,
field
=
models
.
TextField
(
blank
=
True
,
default
=
''
,
null
=
True
,
verbose_name
=
'Content'
),
),
migrations
.
AlterField
(
model_name
=
'certificatetemplate'
,
name
=
'text_en'
,
field
=
models
.
TextField
(
blank
=
True
,
default
=
''
,
null
=
True
,
verbose_name
=
'Content'
),
),
migrations
.
AlterField
(
model_name
=
'certificatetemplate'
,
name
=
'text_es'
,
field
=
models
.
TextField
(
blank
=
True
,
default
=
''
,
null
=
True
,
verbose_name
=
'Content'
),
),
migrations
.
AlterField
(
model_name
=
'certificatetemplate'
,
name
=
'text_pt_br'
,
field
=
models
.
TextField
(
blank
=
True
,
default
=
''
,
null
=
True
,
verbose_name
=
'Content'
),
),
]
courses/certification/models.py
View file @
245ae8b3
...
...
@@ -256,21 +256,34 @@ class CertificateTemplate(models.Model):
blank
=
True
,
upload_to
=
'certificates_files'
)
background_image
=
models
.
ImageField
(
_
(
'Background image'
),
null
=
True
,
blank
=
True
,
upload_to
=
'certificates_files'
)
display_background_image
=
models
.
BooleanField
(
_
(
'Display background image'
),
default
=
True
,
)
organization_name
=
models
.
CharField
(
_
(
'Name'
),
max_length
=
255
,
blank
=
True
,
null
=
True
,
)
text
=
models
.
TextField
(
_
(
'Content'
),
default
=
''
)
text
=
models
.
TextField
(
_
(
'Content'
),
default
=
''
,
null
=
True
,
blank
=
True
,
)
document_type
=
models
.
CharField
(
_
(
'Certificate Type'
),
choices
=
TYPES
,
max_length
=
127
,
default
=
TYPES
[
0
][
0
]
)
workspace
=
models
.
ForeignKey
(
Workspace
,
models
.
CASCADE
,
...
...
courses/certification/serializers.py
View file @
245ae8b3
...
...
@@ -16,14 +16,15 @@ class CertificateTemplateSerializer(serializers.ModelSerializer):
course_name
=
serializers
.
SerializerMethodField
(
read_only
=
True
,)
# TODO: Legacy compat field, remove in the future
contract
=
serializers
.
SerializerMethodField
()
contract
=
serializers
.
SerializerMethodField
(
read_only
=
True
)
class
Meta
:
model
=
CertificateTemplate
fields
=
(
'id'
,
'text'
,
'base_logo_url'
,
'cert_logo_url'
,
'role'
,
'name'
,
'course_name'
,
'contract'
,
'associate'
,
'workspace'
,
'document_type'
,
'organization_name'
,
'site_logo_url'
,
'signature_url'
,
'course'
,
'second_signature_url'
,
'second_name'
,
'second_role'
)
'second_signature_url'
,
'second_name'
,
'second_role'
,
'display_background_image'
,)
def
get_associate
(
self
,
obj
):
filters
=
{
...
...
@@ -53,7 +54,14 @@ class CertificateTemplateImageSerializer(serializers.ModelSerializer):
class
Meta
:
model
=
CertificateTemplate
fields
=
(
'base_logo'
,
'cert_logo'
,
'signature'
,
'site_logo'
,
'second_signature'
)
fields
=
(
'base_logo'
,
'cert_logo'
,
'signature'
,
'site_logo'
,
'second_signature'
,
'background_image'
,
)
class
CertificationProcessSerializer
(
serializers
.
ModelSerializer
):
...
...
courses/certification/views.py
View file @
245ae8b3
...
...
@@ -119,7 +119,7 @@ class CourseCertificationViewSet(viewsets.ModelViewSet):
class
CertificateTemplateViewSet
(
viewsets
.
ModelViewSet
):
model
=
CertificateTemplate
queryset
=
CertificateTemplate
.
objects
.
all
()
#lookup
_field = 'course'
filter
_field
s
=
(
'course'
,)
permission_classes
=
(
IsProfessorCoordinatorOrAdminPermissionOrReadOnly
,
)
serializer_class
=
CertificateTemplateSerializer
...
...
@@ -152,13 +152,6 @@ class CertificateTemplateViewSet(viewsets.ModelViewSet):
else
:
return
Response
(
serializer
.
errors
,
status
=
status
.
HTTP_400_BAD_REQUEST
)
def
update
(
self
,
request
,
**
kwargs
):
instance
=
self
.
get_object
()
serializer
=
self
.
get_serializer
(
instance
,
data
=
request
.
data
)
if
serializer
.
is_valid
():
serializer
.
save
()
return
Response
(
serializer
.
data
)
class
CertificateTemplateImageViewSet
(
viewsets
.
ModelViewSet
):
queryset
=
CertificateTemplate
.
objects
.
all
()
...
...
courses/migrations/0031_auto_20210730_1115.py
0 → 100644
View file @
245ae8b3
# Generated by Django 2.2.24 on 2021-07-30 14:15
import
courses.videos.models
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'courses'
,
'0030_video_file'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'course'
,
name
=
'intro_video_en'
,
),
migrations
.
RemoveField
(
model_name
=
'course'
,
name
=
'intro_video_es'
,
),
migrations
.
RemoveField
(
model_name
=
'course'
,
name
=
'intro_video_pt_br'
,
),
migrations
.
RemoveField
(
model_name
=
'unit'
,
name
=
'video_en'
,
),
migrations
.
RemoveField
(
model_name
=
'unit'
,
name
=
'video_es'
,
),
migrations
.
RemoveField
(
model_name
=
'unit'
,
name
=
'video_pt_br'
,
),
migrations
.
AddField
(
model_name
=
'video'
,
name
=
'file_en'
,
field
=
models
.
FileField
(
default
=
None
,
null
=
True
,
upload_to
=
courses
.
videos
.
models
.
get_upload_path
),
),
migrations
.
AddField
(
model_name
=
'video'
,
name
=
'file_es'
,
field
=
models
.
FileField
(
default
=
None
,
null
=
True
,
upload_to
=
courses
.
videos
.
models
.
get_upload_path
),
),
migrations
.
AddField
(
model_name
=
'video'
,
name
=
'file_pt_br'
,
field
=
models
.
FileField
(
default
=
None
,
null
=
True
,
upload_to
=
courses
.
videos
.
models
.
get_upload_path
),
),
migrations
.
AddField
(
model_name
=
'video'
,
name
=
'name_en'
,
field
=
models
.
CharField
(
max_length
=
255
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'video'
,
name
=
'name_es'
,
field
=
models
.
CharField
(
max_length
=
255
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'video'
,
name
=
'name_pt_br'
,
field
=
models
.
CharField
(
max_length
=
255
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'video'
,
name
=
'youtube_id_en'
,
field
=
models
.
CharField
(
max_length
=
100
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'video'
,
name
=
'youtube_id_es'
,
field
=
models
.
CharField
(
max_length
=
100
,
null
=
True
),
),
migrations
.
AddField
(
model_name
=
'video'
,
name
=
'youtube_id_pt_br'
,
field
=
models
.
CharField
(
max_length
=
100
,
null
=
True
),
),
]
courses/translation.py
View file @
245ae8b3
...
...
@@ -8,7 +8,7 @@ from .certification.models import CertificateTemplate
@
register
(
Course
)
class
CourseTranslationOptions
(
TranslationOptions
):
fields
=
(
'slug'
,
'name'
,
'intro_video'
,
'application'
,
fields
=
(
'slug'
,
'name'
,
'application'
,
'requirement'
,
'abstract'
,
'structure'
,
'workload'
,
'course_load'
,
'pronatec'
,
'thumbnail'
,
'home_thumbnail'
,
'min_percent_to_complete'
,
'informations'
,
'description'
)
...
...
@@ -21,7 +21,7 @@ class LessonTranslationOptions(TranslationOptions):
@
register
(
Unit
)
class
UnitTranslationOptions
(
TranslationOptions
):
fields
=
(
'title'
,
'video'
,
'side_notes'
,
'chat_room'
)
fields
=
(
'title'
,
'side_notes'
,
'chat_room'
)
@
register
(
ProfessorMessage
)
...
...
courses/videos/serializers.py
View file @
245ae8b3
...
...
@@ -7,7 +7,7 @@ class VideoSerializer(serializers.ModelSerializer):
class
Meta
:
model
=
Video
fields
=
(
'id'
,
'name'
,
'youtube_id'
,)
fields
=
(
'id'
,
'name'
,
'youtube_id'
,
'file'
)
read_only_fields
=
(
'file'
,)
...
...
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