diff --git a/courses/templates/subject/form_view_teacher.html b/courses/templates/subject/form_view_teacher.html index 1f8b87c..613ee93 100644 --- a/courses/templates/subject/form_view_teacher.html +++ b/courses/templates/subject/form_view_teacher.html @@ -1,4 +1,4 @@ -{% load static i18n list_topic_foruns permission_tags widget_tweaks professor_access list_topic_exercises%} +{% load static i18n list_topic_foruns permission_tags widget_tweaks professor_access list_topic_exercises %}
@@ -112,6 +112,7 @@
@@ -122,6 +123,13 @@ {% list_topic_foruns request topic %}
+
+ + {# exercícios do tópico no modo de edição #} + +
diff --git a/exercise/forms.py b/exercise/forms.py index c76c054..fcb4930 100644 --- a/exercise/forms.py +++ b/exercise/forms.py @@ -7,10 +7,21 @@ import requests class ExerciseForm(forms.ModelForm): + def __init__(self, *args, **kwargs): + super(ExerciseForm, self).__init__(*args, **kwargs) + self.fields["allowed"].required = False + self.fields["allowed"].initial = False + + # def clean_allowed(self): + # if('allowed' in self.data): + # allowed = self.data['allowed'] + # raise forms.ValidationError(_('It is required one these fields.')) + # return True + class Meta: model = Exercise fields = ['name_exercise', 'description', - 'end_date', 'file'] + 'end_date', 'file', 'allowed'] class UpdateExerciseForm(forms.ModelForm): @@ -18,4 +29,4 @@ class UpdateExerciseForm(forms.ModelForm): class Meta: model = Exercise fields = ['name_exercise', 'description', - 'end_date', 'grade', 'file'] + 'end_date', 'file'] diff --git a/exercise/migrations/0005_exercise_allowed.py b/exercise/migrations/0005_exercise_allowed.py new file mode 100644 index 0000000..f80cfd8 --- /dev/null +++ b/exercise/migrations/0005_exercise_allowed.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10 on 2016-11-21 12:50 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('exercise', '0004_auto_20161121_0922'), + ] + + operations = [ + migrations.AddField( + model_name='exercise', + name='allowed', + field=models.BooleanField(default=False, verbose_name='Allowed delivery after end date?'), + ), + ] diff --git a/exercise/migrations/0006_auto_20161121_1008.py b/exercise/migrations/0006_auto_20161121_1008.py new file mode 100644 index 0000000..c0da128 --- /dev/null +++ b/exercise/migrations/0006_auto_20161121_1008.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10 on 2016-11-21 13:08 +from __future__ import unicode_literals + +from django.db import migrations, models +import exercise.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('exercise', '0005_exercise_allowed'), + ] + + operations = [ + migrations.AlterField( + model_name='exercise', + name='file', + field=models.FileField(upload_to=exercise.models.file_path, verbose_name='File'), + ), + ] diff --git a/exercise/migrations/0007_auto_20161121_1019.py b/exercise/migrations/0007_auto_20161121_1019.py new file mode 100644 index 0000000..8b4e5f7 --- /dev/null +++ b/exercise/migrations/0007_auto_20161121_1019.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10 on 2016-11-21 13:19 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('exercise', '0006_auto_20161121_1008'), + ] + + operations = [ + migrations.AlterField( + model_name='exercise', + name='file', + field=models.FileField(upload_to='uploads/%Y/%m/%d'), + ), + ] diff --git a/exercise/models.py b/exercise/models.py index 4f7a071..df0c25a 100644 --- a/exercise/models.py +++ b/exercise/models.py @@ -30,6 +30,7 @@ class Exercise(models.Model): students = models.ManyToManyField(User, verbose_name=_('Students'), related_name='subject_exercise', blank = True) file = models.FileField(upload_to='uploads/%Y/%m/%d') file_type = models.ForeignKey(MimeType, verbose_name=_('Type file'), related_name='exercise_type',null=True) + allowed = models.BooleanField(_('Allowed delivery after end date?'), default=False) def __str__(self): return self.name_exercise diff --git a/exercise/templates/exercise/create_exercise.html b/exercise/templates/exercise/create_exercise.html index e4c2cf3..87d5e92 100644 --- a/exercise/templates/exercise/create_exercise.html +++ b/exercise/templates/exercise/create_exercise.html @@ -41,10 +41,10 @@ {% else %} - {% render_field field class='form-control input-sm' %} - {{ field.help_text }} + {% render_field field class='form-control input-sm' %} + {{ field.help_text }} {% endif %} - + {% if field.errors %}