Commit 245ae8b3 authored by Matheus Miranda's avatar Matheus Miranda
Browse files

Merge branch 'develop' into 'master'

Update translation for Video model

See merge request !77
parents a06a05b7 620c8e37
# 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'),
),
]
......@@ -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,
......
......@@ -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):
......
......@@ -119,7 +119,7 @@ class CourseCertificationViewSet(viewsets.ModelViewSet):
class CertificateTemplateViewSet(viewsets.ModelViewSet):
model = CertificateTemplate
queryset = CertificateTemplate.objects.all()
#lookup_field = 'course'
filter_fields = ('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()
......
# 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),
),
]
......@@ -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)
......
......@@ -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',)
......
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