Commit f100872178620564df2b52018b9a101cc1dff819
1 parent
750b5ae6
Exists in
master
and in
5 other branches
Changing students field in (Course and Subject) to non-required [Issues: #192 and #195]
Showing
3 changed files
with
56 additions
and
3 deletions
Show diff stats
... | ... | @@ -0,0 +1,21 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2016-10-20 21:08 | |
3 | +from __future__ import unicode_literals | |
4 | + | |
5 | +from django.conf import settings | |
6 | +from django.db import migrations, models | |
7 | + | |
8 | + | |
9 | +class Migration(migrations.Migration): | |
10 | + | |
11 | + dependencies = [ | |
12 | + ('courses', '0003_course_public'), | |
13 | + ] | |
14 | + | |
15 | + operations = [ | |
16 | + migrations.AlterField( | |
17 | + model_name='course', | |
18 | + name='students', | |
19 | + field=models.ManyToManyField(blank=True, related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
20 | + ), | |
21 | + ] | ... | ... |
courses/models.py
... | ... | @@ -45,7 +45,7 @@ class Course(models.Model): |
45 | 45 | image = models.ImageField(verbose_name = _('Image'), blank = True, upload_to = 'courses/') |
46 | 46 | category = models.ForeignKey(CourseCategory, verbose_name = _('Category'), related_name='course_category') |
47 | 47 | professors = models.ManyToManyField(User,verbose_name=_('Professors'), related_name='courses_professors') |
48 | - students = models.ManyToManyField(User,verbose_name=_('Students'), related_name='courses_student') | |
48 | + students = models.ManyToManyField(User,verbose_name=_('Students'), related_name='courses_student', blank = True) | |
49 | 49 | public = models.BooleanField(_('Public')) |
50 | 50 | |
51 | 51 | class Meta: |
... | ... | @@ -69,8 +69,7 @@ class Subject(models.Model): |
69 | 69 | course = models.ForeignKey(Course, verbose_name = _('Course'), related_name="subjects") |
70 | 70 | category = models.ForeignKey(CategorySubject, verbose_name = _('Category'), related_name='subject_category',null=True) |
71 | 71 | professors = models.ManyToManyField(User,verbose_name=_('Professors'), related_name='professors_subjects') |
72 | - students = models.ManyToManyField(User,verbose_name=_('Students'), related_name='subject_student') | |
73 | - | |
72 | + students = models.ManyToManyField(User,verbose_name=_('Students'), related_name='subject_student', blank = True) | |
74 | 73 | |
75 | 74 | class Meta: |
76 | 75 | ordering = ('create_date','name') | ... | ... |
... | ... | @@ -0,0 +1,33 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2016-10-20 21:08 | |
3 | +from __future__ import unicode_literals | |
4 | + | |
5 | +from django.conf import settings | |
6 | +from django.db import migrations, models | |
7 | +import django.db.models.deletion | |
8 | + | |
9 | + | |
10 | +class Migration(migrations.Migration): | |
11 | + | |
12 | + dependencies = [ | |
13 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
14 | + ('exam', '0001_initial'), | |
15 | + ] | |
16 | + | |
17 | + operations = [ | |
18 | + migrations.CreateModel( | |
19 | + name='AnswersStudent', | |
20 | + fields=[ | |
21 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |
22 | + ('status', models.BooleanField(default=False, verbose_name='Answered')), | |
23 | + ('answered_in', models.DateTimeField(auto_now=True, verbose_name='Answered Date')), | |
24 | + ('answer', models.ManyToManyField(related_name='student_answer', to='exam.Answer', verbose_name='Answers Students')), | |
25 | + ('exam', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student_exam', to='exam.Exam', verbose_name='Exam')), | |
26 | + ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student', to=settings.AUTH_USER_MODEL, verbose_name='Student')), | |
27 | + ], | |
28 | + options={ | |
29 | + 'verbose_name': 'Answer Stundent', | |
30 | + 'verbose_name_plural': 'Answers Student', | |
31 | + }, | |
32 | + ), | |
33 | + ] | ... | ... |