Commit ba2e1913511dea44c922e9beee935de3a99f2163
1 parent
b74aedc4
Exists in
master
and in
5 other branches
list material
Showing
9 changed files
with
90 additions
and
8 deletions
Show diff stats
courses/templates/subject/form_view_teacher.html
1 | -{% load static i18n list_topic_foruns permission_tags widget_tweaks professor_access list_topic_exercises%} | |
1 | +{% load static i18n list_topic_foruns permission_tags widget_tweaks professor_access list_topic_exercises %} | |
2 | 2 | |
3 | 3 | <div class="panel panel-default cards-detail"> |
4 | 4 | <div class="panel-heading topic"> |
... | ... | @@ -112,6 +112,7 @@ |
112 | 112 | <ul> |
113 | 113 | {% list_topic_poll request topic %} |
114 | 114 | {% list_topic_foruns request topic %} |
115 | + {% list_topic_exercise request topic %} | |
115 | 116 | </ul> |
116 | 117 | </div> |
117 | 118 | <div class="editation editation_{{topic.slug}}"> |
... | ... | @@ -122,6 +123,13 @@ |
122 | 123 | {% list_topic_foruns request topic %} |
123 | 124 | </ul> |
124 | 125 | </div> |
126 | + <div class="editation editation_{{topic.slug}}"> | |
127 | + | |
128 | + {# exercícios do tópico no modo de edição #} | |
129 | + <ul> | |
130 | + {% list_topic_exercise_edit request topic %} | |
131 | + </ul> | |
132 | + </div> | |
125 | 133 | </div> |
126 | 134 | </div> |
127 | 135 | ... | ... |
exercise/forms.py
... | ... | @@ -7,10 +7,21 @@ import requests |
7 | 7 | |
8 | 8 | class ExerciseForm(forms.ModelForm): |
9 | 9 | |
10 | + def __init__(self, *args, **kwargs): | |
11 | + super(ExerciseForm, self).__init__(*args, **kwargs) | |
12 | + self.fields["allowed"].required = False | |
13 | + self.fields["allowed"].initial = False | |
14 | + | |
15 | + # def clean_allowed(self): | |
16 | + # if('allowed' in self.data): | |
17 | + # allowed = self.data['allowed'] | |
18 | + # raise forms.ValidationError(_('It is required one these fields.')) | |
19 | + # return True | |
20 | + | |
10 | 21 | class Meta: |
11 | 22 | model = Exercise |
12 | 23 | fields = ['name_exercise', 'description', |
13 | - 'end_date', 'file'] | |
24 | + 'end_date', 'file', 'allowed'] | |
14 | 25 | |
15 | 26 | |
16 | 27 | class UpdateExerciseForm(forms.ModelForm): |
... | ... | @@ -18,4 +29,4 @@ class UpdateExerciseForm(forms.ModelForm): |
18 | 29 | class Meta: |
19 | 30 | model = Exercise |
20 | 31 | fields = ['name_exercise', 'description', |
21 | - 'end_date', 'grade', 'file'] | |
32 | + 'end_date', 'file'] | ... | ... |
... | ... | @@ -0,0 +1,20 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2016-11-21 12:50 | |
3 | +from __future__ import unicode_literals | |
4 | + | |
5 | +from django.db import migrations, models | |
6 | + | |
7 | + | |
8 | +class Migration(migrations.Migration): | |
9 | + | |
10 | + dependencies = [ | |
11 | + ('exercise', '0004_auto_20161121_0922'), | |
12 | + ] | |
13 | + | |
14 | + operations = [ | |
15 | + migrations.AddField( | |
16 | + model_name='exercise', | |
17 | + name='allowed', | |
18 | + field=models.BooleanField(default=False, verbose_name='Allowed delivery after end date?'), | |
19 | + ), | |
20 | + ] | ... | ... |
... | ... | @@ -0,0 +1,21 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2016-11-21 13:08 | |
3 | +from __future__ import unicode_literals | |
4 | + | |
5 | +from django.db import migrations, models | |
6 | +import exercise.models | |
7 | + | |
8 | + | |
9 | +class Migration(migrations.Migration): | |
10 | + | |
11 | + dependencies = [ | |
12 | + ('exercise', '0005_exercise_allowed'), | |
13 | + ] | |
14 | + | |
15 | + operations = [ | |
16 | + migrations.AlterField( | |
17 | + model_name='exercise', | |
18 | + name='file', | |
19 | + field=models.FileField(upload_to=exercise.models.file_path, verbose_name='File'), | |
20 | + ), | |
21 | + ] | ... | ... |
... | ... | @@ -0,0 +1,20 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2016-11-21 13:19 | |
3 | +from __future__ import unicode_literals | |
4 | + | |
5 | +from django.db import migrations, models | |
6 | + | |
7 | + | |
8 | +class Migration(migrations.Migration): | |
9 | + | |
10 | + dependencies = [ | |
11 | + ('exercise', '0006_auto_20161121_1008'), | |
12 | + ] | |
13 | + | |
14 | + operations = [ | |
15 | + migrations.AlterField( | |
16 | + model_name='exercise', | |
17 | + name='file', | |
18 | + field=models.FileField(upload_to='uploads/%Y/%m/%d'), | |
19 | + ), | |
20 | + ] | ... | ... |
exercise/models.py
... | ... | @@ -30,6 +30,7 @@ class Exercise(models.Model): |
30 | 30 | students = models.ManyToManyField(User, verbose_name=_('Students'), related_name='subject_exercise', blank = True) |
31 | 31 | file = models.FileField(upload_to='uploads/%Y/%m/%d') |
32 | 32 | file_type = models.ForeignKey(MimeType, verbose_name=_('Type file'), related_name='exercise_type',null=True) |
33 | + allowed = models.BooleanField(_('Allowed delivery after end date?'), default=False) | |
33 | 34 | |
34 | 35 | def __str__(self): |
35 | 36 | return self.name_exercise | ... | ... |
exercise/templates/exercise/create_exercise.html
... | ... | @@ -41,10 +41,10 @@ |
41 | 41 | </span> |
42 | 42 | </div> |
43 | 43 | {% else %} |
44 | - {% render_field field class='form-control input-sm' %} | |
45 | - <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | |
44 | + {% render_field field class='form-control input-sm' %} | |
45 | + <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | |
46 | 46 | {% endif %} |
47 | - </div> | |
47 | + </div> | |
48 | 48 | |
49 | 49 | {% if field.errors %} |
50 | 50 | <div class="alert alert-danger alert-dismissible clearfix" role="alert"> |
... | ... | @@ -97,6 +97,7 @@ |
97 | 97 | $('#list-topic{{ topic.id }}-exercises').append(data); |
98 | 98 | $('#list-topic{{ topic.id }}-exercises-edit').append(data); |
99 | 99 | alertify.success('Exercise successfully created!') |
100 | + setTimeout(function () { location.reload(1); }, 1000); | |
100 | 101 | }, |
101 | 102 | error: function(data){ |
102 | 103 | $('#requisicoes_ajax').empty(); | ... | ... |
exercise/templates/exercise/exercise_edit.html
... | ... | @@ -2,6 +2,6 @@ |
2 | 2 | <div id="exercise-topic{{ topic.id }}-exercises-edit"> |
3 | 3 | {% for exercise in exercises %} |
4 | 4 | <li class="icon_edit_remove" id = "exercise_edit_icon_{{ exercise.slug }}"> <a href="javascript:modal.get('', '#exercisesModalEdit', '#requisicoes_ajax')"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a> <a href="javascript:modal.get('', '#exerciseDeleteModal', '#requisicoes_ajax')"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a></li> |
5 | - <li id = "exercise_edit_{{ exercise.slug }}"><i class="fa fa-link" aria-hidden="true"></i> <a href="javascript:modal.get('', '#viewExerciseModal','#requisicoes_ajax')">{{exercise.name}}</a></li> | |
5 | + <li id = "exercise_edit_{{ exercise.slug }}"><i class="fa fa-file" aria-hidden="true"></i> <a href="javascript:modal.get('', '#viewExerciseModal','#requisicoes_ajax')">{{exercise.name_exercise}}</a></li> | |
6 | 6 | {% endfor %} |
7 | 7 | </div> | ... | ... |
exercise/templates/exercise/exercise_list.html
1 | 1 | {% load static i18n list_topic_foruns permission_tags %} |
2 | 2 | <div id="list-topic{{ topic.id }}-exercises"> |
3 | 3 | {% for exercise in exercises %} |
4 | - <li id="exercise_{{ exercise.slug }}"><i class="fa fa-link" aria-hidden="true"></i> <a href="{{exercise.file.url}}">{{exercise.name}}</a></li> | |
4 | + <li id="exercise_{{ exercise.slug }}"><i class="fa fa-file" aria-hidden="true"></i> <a href="{{exercise.file.url}}">{{exercise.name_exercise}}</a></li> | |
5 | 5 | {% endfor %} |
6 | 6 | </div> | ... | ... |