Commit 4de29c5f authored by Matheus Miranda's avatar Matheus Miranda

Merge branch 'develop' into 'master'

Add translation for course material

See merge request !51
parents 61328c8e ef2beb5e
......@@ -42,3 +42,6 @@ class File(models.Model):
related_name='files',
verbose_name=_('Files'),
)
class Meta:
ordering = ['-pk']
......@@ -11,7 +11,7 @@ class CourseMaterialViewSet(viewsets.ModelViewSet):
serializer_class = CourseMaterialSerializer
permission_classes = (IsAuthenticated,)
lookup_field = 'course'
filter_fields = ('course__id',)
filter_fields = ('course__id', 'course__slug')
def pre_save(self, obj):
# Get Question vote usign kwarg as questionId
......@@ -21,7 +21,7 @@ class CourseMaterialViewSet(viewsets.ModelViewSet):
return super(CourseMaterialViewSet, self).pre_save(obj)
class CourseMaterialFileViewSet(mixins.DestroyModelMixin, viewsets.GenericViewSet):
class CourseMaterialFileViewSet(viewsets.ModelViewSet):
model = CourseMaterialFile
queryset = CourseMaterialFile.objects.all()
serializer_class = FilesSerializer
......
# Generated by Django 2.2.20 on 2021-04-21 04:06
import courses.course_material.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('courses', '0024_auto_20210416_1715'),
]
operations = [
migrations.AddField(
model_name='file',
name='file_en',
field=models.FileField(null=True, upload_to=courses.course_material.models.get_upload_path),
),
migrations.AddField(
model_name='file',
name='file_es',
field=models.FileField(null=True, upload_to=courses.course_material.models.get_upload_path),
),
migrations.AddField(
model_name='file',
name='file_pt_br',
field=models.FileField(null=True, upload_to=courses.course_material.models.get_upload_path),
),
]
......@@ -26,4 +26,4 @@ class UnitTranslationOptions(TranslationOptions):
@register(File)
class UnitTranslationOptions(TranslationOptions):
fields = ('title',)
\ No newline at end of file
fields = ('title', 'file')
\ No newline at end of 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