Commit 6813502000cba7ac8b0420876d91e67748b1bc43
1 parent
35b73722
Exists in
master
and in
3 other branches
modified subject form and model to have a subscribe begin date and subscribe end date
Showing
7 changed files
with
57 additions
and
82 deletions
Show diff stats
subjects/forms.py
| ... | ... | @@ -16,8 +16,8 @@ class CreateSubjectForm(forms.ModelForm): |
| 16 | 16 | class Meta: |
| 17 | 17 | model = Subject |
| 18 | 18 | |
| 19 | - fields = ('name', 'description_brief', 'description', 'init_date', 'end_date', 'visible', 'professor', | |
| 20 | - 'students', ) | |
| 19 | + fields = ('name', 'description_brief', 'description', 'init_date', 'end_date','subscribe_begin', 'subscribe_end', | |
| 20 | + 'visible', 'professor', 'students', ) | |
| 21 | 21 | |
| 22 | 22 | |
| 23 | 23 | widgets = { | ... | ... |
subjects/migrations/0010_auto_20170109_2304.py
| ... | ... | @@ -1,27 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -# Generated by Django 1.10.4 on 2017-01-10 02:04 | |
| 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 | - ('subjects', '0009_auto_20170105_1835'), | |
| 12 | - ] | |
| 13 | - | |
| 14 | - operations = [ | |
| 15 | - migrations.AddField( | |
| 16 | - model_name='subject', | |
| 17 | - name='subscribe_begin', | |
| 18 | - field=models.DateTimeField(default=1, verbose_name='Begin Subscribe'), | |
| 19 | - preserve_default=False, | |
| 20 | - ), | |
| 21 | - migrations.AddField( | |
| 22 | - model_name='subject', | |
| 23 | - name='subscribe_end', | |
| 24 | - field=models.DateTimeField(default=1, verbose_name='End Subscribe'), | |
| 25 | - preserve_default=False, | |
| 26 | - ), | |
| 27 | - ] |
| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.10.4 on 2017-01-10 17:39 | |
| 3 | +from __future__ import unicode_literals | |
| 4 | + | |
| 5 | +from django.db import migrations, models | |
| 6 | +import django.utils.timezone | |
| 7 | + | |
| 8 | + | |
| 9 | +class Migration(migrations.Migration): | |
| 10 | + | |
| 11 | + dependencies = [ | |
| 12 | + ('subjects', '0009_auto_20170105_1835'), | |
| 13 | + ] | |
| 14 | + | |
| 15 | + operations = [ | |
| 16 | + migrations.AddField( | |
| 17 | + model_name='subject', | |
| 18 | + name='subscribe_begin', | |
| 19 | + field=models.DateField(auto_now_add=True, default=django.utils.timezone.now, verbose_name='Begin Subscribe'), | |
| 20 | + preserve_default=False, | |
| 21 | + ), | |
| 22 | + migrations.AddField( | |
| 23 | + model_name='subject', | |
| 24 | + name='subscribe_end', | |
| 25 | + field=models.DateField(auto_now_add=True, default=django.utils.timezone.now, verbose_name='End Subscribe'), | |
| 26 | + preserve_default=False, | |
| 27 | + ), | |
| 28 | + ] | ... | ... |
subjects/migrations/0011_auto_20170109_2308.py
| ... | ... | @@ -1,26 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -# Generated by Django 1.10.4 on 2017-01-10 02:08 | |
| 3 | -from __future__ import unicode_literals | |
| 4 | - | |
| 5 | -import datetime | |
| 6 | -from django.db import migrations, models | |
| 7 | - | |
| 8 | - | |
| 9 | -class Migration(migrations.Migration): | |
| 10 | - | |
| 11 | - dependencies = [ | |
| 12 | - ('subjects', '0010_auto_20170109_2304'), | |
| 13 | - ] | |
| 14 | - | |
| 15 | - operations = [ | |
| 16 | - migrations.AlterField( | |
| 17 | - model_name='subject', | |
| 18 | - name='subscribe_begin', | |
| 19 | - field=models.DateTimeField(default=datetime.datetime.now, verbose_name='Begin Subscribe'), | |
| 20 | - ), | |
| 21 | - migrations.AlterField( | |
| 22 | - model_name='subject', | |
| 23 | - name='subscribe_end', | |
| 24 | - field=models.DateTimeField(default=datetime.datetime.now, verbose_name='End Subscribe'), | |
| 25 | - ), | |
| 26 | - ] |
| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.10.4 on 2017-01-10 17:46 | |
| 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 | + ('subjects', '0010_auto_20170110_1439'), | |
| 12 | + ] | |
| 13 | + | |
| 14 | + operations = [ | |
| 15 | + migrations.AlterField( | |
| 16 | + model_name='subject', | |
| 17 | + name='subscribe_begin', | |
| 18 | + field=models.DateField(verbose_name='Begin Subscribe'), | |
| 19 | + ), | |
| 20 | + migrations.AlterField( | |
| 21 | + model_name='subject', | |
| 22 | + name='subscribe_end', | |
| 23 | + field=models.DateField(verbose_name='End Subscribe'), | |
| 24 | + ), | |
| 25 | + ] | ... | ... |
subjects/migrations/0012_auto_20170109_2312.py
| ... | ... | @@ -1,25 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -# Generated by Django 1.10.4 on 2017-01-10 02:12 | |
| 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 | - ('subjects', '0011_auto_20170109_2308'), | |
| 12 | - ] | |
| 13 | - | |
| 14 | - operations = [ | |
| 15 | - migrations.AlterField( | |
| 16 | - model_name='subject', | |
| 17 | - name='subscribe_begin', | |
| 18 | - field=models.DateTimeField(verbose_name='Begin Subscribe'), | |
| 19 | - ), | |
| 20 | - migrations.AlterField( | |
| 21 | - model_name='subject', | |
| 22 | - name='subscribe_end', | |
| 23 | - field=models.DateTimeField(verbose_name='End Subscribe'), | |
| 24 | - ), | |
| 25 | - ] |
subjects/models.py
| ... | ... | @@ -30,8 +30,8 @@ class Subject(models.Model): |
| 30 | 30 | create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) |
| 31 | 31 | update_date = models.DateTimeField(_('Date of last update'), auto_now=True) |
| 32 | 32 | |
| 33 | - #subscribe_begin = models.DateTimeField(_('Begin Subscribe')) | |
| 34 | - #subscribe_end = models.DateTimeField(_('End Subscribe')) | |
| 33 | + subscribe_begin = models.DateField(_('Begin Subscribe')) | |
| 34 | + subscribe_end = models.DateField(_('End Subscribe')) | |
| 35 | 35 | |
| 36 | 36 | professor = models.ManyToManyField(User, related_name="professors", blank=True) |
| 37 | 37 | students = models.ManyToManyField(User,verbose_name=_('Students'), related_name='subject_student', blank = True) | ... | ... |