translation.py 1.59 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
from .certification.models import CertificateTemplate
6 7 8 9 10 11 12


@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
13
              'min_percent_to_complete', 'informations', 'description')
14 15 16 17 18 19 20 21 22 23


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


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

25

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


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

35

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


@register(AccessibleArea)
class AccessibleAreaTranslationOptions(TranslationOptions):
    fields = ('name', 'slug')
44 45 46 47 48 49 50


@register(CertificateTemplate)
class CertificateTemplateTranslationOptions(TranslationOptions):
    fields = ('role', 'name', 'second_role', 'second_name', 'cert_logo',
              'base_logo', 'signature', 'second_signature', 'site_logo',
              'organization_name', 'text')
Matheus Miranda's avatar
Matheus Miranda committed
51