Commit 51f6cd9eebc8118aff94900ab77ab8f38511a115

Authored by juliotoscano
1 parent 9bc93f76

added coordenator #229

courses/forms.py
... ... @@ -51,34 +51,37 @@ class CourseForm(forms.ModelForm):
51 51 class Meta:
52 52 model = Course
53 53 fields = ('name', 'objectivies', 'content', 'max_students', 'init_register_date', 'end_register_date',
54   - 'init_date', 'end_date', 'category',)
  54 + 'init_date', 'end_date', 'category', 'coordenator')
55 55 labels = {
56   - 'name': _('Name'),
57   - 'objectivies': _('Objectives'),
58   - 'content': _('Content'),
59   - 'max_students': _('Number of studets maximum'),
60   - 'init_register_date': _('Course registration start date'),
61   - 'end_register_date': _('Course registration end date'),
62   - 'init_date': _('Course start date'),
63   - 'end_date': _('Course end date'),
64   - 'category': _('CourseCategory'),
  56 + 'name': _('Name'),
  57 + 'objectivies': _('Objectives'),
  58 + 'content': _('Content'),
  59 + 'max_students': _('Number of studets maximum'),
  60 + 'init_register_date': _('Course registration start date'),
  61 + 'end_register_date': _('Course registration end date'),
  62 + 'init_date': _('Course start date'),
  63 + 'end_date': _('Course end date'),
  64 + 'category': _('CourseCategory'),
  65 + 'coordenator': _('Coordenator'),
65 66 }
66 67 help_texts = {
67   - 'name': _('Course name'),
68   - 'objectivies': _('Course objective'),
69   - 'content': _('Course modules'),
70   - 'max_students': _('Max number of students that a class can have'),
71   - 'init_register_date': _('Date that starts the registration period of the course (dd/mm/yyyy)'),
72   - 'end_register_date': _('Date that ends the registration period of the course (dd/mm/yyyy)'),
73   - 'init_date': _('Date that the course starts (dd/mm/yyyy)'),
74   - 'end_date': _('Date that the course ends (dd/mm/yyyy)'),
75   - 'category': _('CourseCategory which the course belongs'),
  68 + 'name': _('Course name'),
  69 + 'objectivies': _('Course objective'),
  70 + 'content': _('Course modules'),
  71 + 'max_students': _('Max number of students that a class can have'),
  72 + 'init_register_date': _('Date that starts the registration period of the course (dd/mm/yyyy)'),
  73 + 'end_register_date': _('Date that ends the registration period of the course (dd/mm/yyyy)'),
  74 + 'init_date': _('Date that the course starts (dd/mm/yyyy)'),
  75 + 'end_date': _('Date that the course ends (dd/mm/yyyy)'),
  76 + 'category': _('CourseCategory which the course belongs'),
  77 + 'coordenator': _('Course Coordenator'),
76 78 }
77 79  
78 80 widgets = {
79   - 'categoy': forms.Select(),
80   - 'objectivies': SummernoteWidget(attrs={'cols': 80, 'rows': 5}),
81   - 'content': SummernoteWidget(attrs={'cols': 80, 'rows': 5}),
  81 + 'categoy': forms.Select(),
  82 + 'coordenator': forms.Select(),
  83 + 'objectivies': SummernoteWidget(attrs={'cols': 80, 'rows': 5}),
  84 + 'content': SummernoteWidget(attrs={'cols': 80, 'rows': 5}),
82 85 }
83 86  
84 87 class UpdateCourseForm(CourseForm):
... ... @@ -89,35 +92,38 @@ class UpdateCourseForm(CourseForm):
89 92 class Meta:
90 93 model = Course
91 94 fields = ('name', 'objectivies', 'content', 'max_students', 'init_register_date', 'end_register_date',
92   - 'init_date', 'end_date', 'category','students',)
  95 + 'init_date', 'end_date', 'category','students', 'coordenator')
93 96 labels = {
94   - 'name': _('Name'),
95   - 'objectivies': _('Objectives'),
96   - 'content': _('Content'),
97   - 'max_students': _('Number of studets maximum'),
98   - 'init_register_date': _('Course registration start date'),
99   - 'end_register_date': _('Course registration end date'),
100   - 'init_date': _('Course start date'),
101   - 'end_date': _('Course end date'),
102   - 'category': _('CourseCategory'),
103   - 'students': _('Student'),
  97 + 'name': _('Name'),
  98 + 'objectivies': _('Objectives'),
  99 + 'content': _('Content'),
  100 + 'max_students': _('Number of studets maximum'),
  101 + 'init_register_date': _('Course registration start date'),
  102 + 'end_register_date': _('Course registration end date'),
  103 + 'init_date': _('Course start date'),
  104 + 'end_date': _('Course end date'),
  105 + 'category': _('CourseCategory'),
  106 + 'coordenator': _('Coordenator'),
  107 + 'students': _('Student'),
104 108 }
105 109 help_texts = {
106   - 'name': _('Course name'),
107   - 'objectivies': _('Course objective'),
108   - 'content': _('Course modules'),
109   - 'max_students': _('Max number of students that a class can have'),
110   - 'init_register_date': _('Date that starts the registration period of the course (dd/mm/yyyy)'),
111   - 'end_register_date': _('Date that ends the registration period of the course (dd/mm/yyyy)'),
112   - 'init_date': _('Date that the course starts (dd/mm/yyyy)'),
113   - 'end_date': _('Date that the course ends (dd/mm/yyyy)'),
114   - 'category': _('CourseCategory which the course belongs'),
115   - 'students': _("Course's Students"),
  110 + 'name': _('Course name'),
  111 + 'objectivies': _('Course objective'),
  112 + 'content': _('Course modules'),
  113 + 'max_students': _('Max number of students that a class can have'),
  114 + 'init_register_date': _('Date that starts the registration period of the course (dd/mm/yyyy)'),
  115 + 'end_register_date': _('Date that ends the registration period of the course (dd/mm/yyyy)'),
  116 + 'init_date': _('Date that the course starts (dd/mm/yyyy)'),
  117 + 'end_date': _('Date that the course ends (dd/mm/yyyy)'),
  118 + 'category': _('CourseCategory which the course belongs'),
  119 + 'coordenator': _('Course Coordenator'),
  120 + 'students': _("Course's Students"),
116 121 }
117 122 widgets = {
118   - 'categoy': forms.Select(),
119   - 'objectivies': SummernoteWidget(attrs={'cols': 80, 'rows': 5}),
120   - 'content': SummernoteWidget(attrs={'cols': 80, 'rows': 5}),
  123 + 'categoy': forms.Select(),
  124 + 'coordenator': forms.Select(),
  125 + 'objectivies': SummernoteWidget(attrs={'cols': 80, 'rows': 5}),
  126 + 'content': SummernoteWidget(attrs={'cols': 80, 'rows': 5}),
121 127 }
122 128  
123 129 class SubjectForm(forms.ModelForm):
... ...
courses/models.py
... ... @@ -47,6 +47,7 @@ class Course(models.Model):
47 47 init_date = models.DateField(_('Begin of Course Date'))
48 48 end_date = models.DateField(_('End of Course Date'))
49 49 category = models.ForeignKey(CourseCategory, verbose_name = _('Category'), related_name='course_category')
  50 + coordenator = models.ForeignKey(User, verbose_name = _('Coordenator'), related_name ='course_coordenator', null = True)
50 51 professors = models.ManyToManyField(User,verbose_name=_('Professors'), related_name='courses_professors')
51 52 students = models.ManyToManyField(User,verbose_name=_('Students'), related_name='courses_student', blank = True)
52 53 public = models.BooleanField(_('Public'), default=False)
... ...
courses/templates/course/course_card.html
... ... @@ -34,6 +34,7 @@
34 34 <div class="panel-collapse collapseOne-{{course.slug}} collapse in" role="tabpanel" aria-labelledby="headingOne" aria-expanded="true" aria-hidden="false" tabindex="0">
35 35 <div class="panel-body">
36 36 <p><b>{% trans 'Course Name' %}: </b>{{course.name}}</p>
  37 + <p><b>{% trans 'Coordenator' %}: </b>{{course.coordenator}}</p>
37 38 <p><b>{% trans 'Professor' %}: </b>{{course.professors.all.0}}</p>
38 39 <p>
39 40 <b>{% trans 'Description' %}:</b>
... ...
courses/templates/course/view.html
... ... @@ -94,8 +94,8 @@
94 94 </div>
95 95 </div>
96 96 <div class="panel-body">
97   - <p><b>{% trans 'Coordinator' %}: </b>{% for professor in course.professors.all %}{% if not forloop.first %},{% endif %}
98   - {{professor}}{% if forloop.last %}.{% endif %}{% endfor %}</p>
  97 + <p><b>{% trans 'Coordinator' %}: </b>{{course.coordenator}}</p>
  98 + <p><b>{% trans 'Teacher' %}: </b>{{course.professors.all.0}}</p>
99 99 <p>
100 100 <b>{% trans 'Description' %}:</b>
101 101 <i>
... ...