forms.py
2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from django import forms
from django.utils.translation import ugettext_lazy as _
from .models import Category, Course, Subject
class CategoryForm(forms.ModelForm):
class Meta:
model = Category
fields = ('name',)
labels = {
'name': _('Name')
}
help_texts = {
'name': _('Category name')
}
class CourseForm(forms.ModelForm):
class Meta:
model = Course
fields = ('name', 'objectivies', 'content', 'max_students', 'init_register_date', 'end_register_date',
'init_date', 'end_date', 'image', 'category',)
labels = {
'name': _('Name'),
'objectivies': _('Objectives'),
'content': _('Content'),
'max_students': _('Number of studets maximum'),
'init_register_date': _('Course registration start date'),
'end_register_date': _('Course registration end date'),
'init_date': _('Course start date'),
'end_date': _('Course end date'),
'image': _('Image'),
'category': _('Category'),
}
help_texts = {
'name': _('Course name'),
'objectivies': _('Course objective'),
'content': _('Course modules'),
'max_students': _('Max number of students that a class can have'),
'init_register_date': _('Date that starts the registration period of the course (dd/mm/yyyy)'),
'end_register_date': _('Date that ends the registration period of the course (dd/mm/yyyy)'),
'init_date': _('Date that the course starts (dd/mm/yyyy)'),
'end_date': _('Date that the course ends (dd/mm/yyyy)'),
'image': _('Representative image of the course'),
'category': _('Category which the course belongs'),
}
widgets = {
'categoy': forms.Select(),
}
class SubjectForm(forms.ModelForm):
class Meta:
model = Subject
fields = ('name', 'description', 'visible',)
labels = {
'name': _('Name'),
'description': _('Description'),
'visible': _('Is it visible?'),
}
help_texts = {
'name': _("Subjects's name"),
'description': _("Subjects's description"),
'visible': _('Is the subject visible?'),
}