translation.py 1.25 KB
Newer Older
1
from modeltranslation.translator import register, TranslationOptions
2
from .models import Course, Lesson, Unit, ProfessorMessage
Glaucia S. Santos's avatar
Glaucia S. Santos committed
3
from .course_material.models import CourseMaterial, File
4
from .stats.models import AccessibleArea
5 6 7 8 9 10 11


@register(Course)
class CourseTranslationOptions(TranslationOptions):
    fields = ('slug', 'name', 'intro_video', 'application',
              'requirement', 'abstract', 'structure', 'workload',
              'course_load', 'pronatec', 'thumbnail', 'home_thumbnail',
Glaucia S. Santos's avatar
Glaucia S. Santos committed
12
              'min_percent_to_complete', 'informations', 'description')
13 14 15 16 17 18 19 20 21 22


@register(Lesson)
class LessonTranslationOptions(TranslationOptions):
    fields = ('desc', 'name', 'notes', 'slug', 'thumbnail')


@register(Unit)
class UnitTranslationOptions(TranslationOptions):
    fields = ('title', 'video', 'side_notes', 'chat_room')
23

24

25 26
@register(ProfessorMessage)
class ProfessorMessageTranslationOptions(TranslationOptions):
27 28 29
    fields = ('subject','message')


Glaucia S. Santos's avatar
Glaucia S. Santos committed
30
@register(CourseMaterial)
31
class CourseMaterialTranslationOptions(TranslationOptions):
Glaucia S. Santos's avatar
Glaucia S. Santos committed
32 33
    fields = ('text',)

34

Glaucia S. Santos's avatar
Glaucia S. Santos committed
35
@register(File)
36 37
class FileTranslationOptions(TranslationOptions):
    fields = ('title', 'file')
38 39 40 41 42


@register(AccessibleArea)
class AccessibleAreaTranslationOptions(TranslationOptions):
    fields = ('name', 'slug')