Commit a4ddb9aec3d518371d606be126d6e38314cd5a5c
Exists in
master
and in
5 other branches
Merge branch 'dev' of https://github.com/amadeusproject/amadeuslms into dev
Showing
27 changed files
with
454 additions
and
158 deletions
Show diff stats
core/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-18 02:46 | 2 | +# Generated by Django 1.10 on 2016-10-18 20:26 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | import autoslug.fields | 5 | import autoslug.fields |
6 | -from django.conf import settings | ||
7 | from django.db import migrations, models | 6 | from django.db import migrations, models |
8 | import django.db.models.deletion | 7 | import django.db.models.deletion |
9 | 8 | ||
@@ -13,7 +12,6 @@ class Migration(migrations.Migration): | @@ -13,7 +12,6 @@ class Migration(migrations.Migration): | ||
13 | initial = True | 12 | initial = True |
14 | 13 | ||
15 | dependencies = [ | 14 | dependencies = [ |
16 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
17 | ] | 15 | ] |
18 | 16 | ||
19 | operations = [ | 17 | operations = [ |
@@ -33,7 +31,6 @@ class Migration(migrations.Migration): | @@ -33,7 +31,6 @@ class Migration(migrations.Migration): | ||
33 | name='Action_Resource', | 31 | name='Action_Resource', |
34 | fields=[ | 32 | fields=[ |
35 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | 33 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
36 | - ('action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied')), | ||
37 | ], | 34 | ], |
38 | options={ | 35 | options={ |
39 | 'verbose_name': 'Action_Resource', | 36 | 'verbose_name': 'Action_Resource', |
@@ -45,8 +42,6 @@ class Migration(migrations.Migration): | @@ -45,8 +42,6 @@ class Migration(migrations.Migration): | ||
45 | fields=[ | 42 | fields=[ |
46 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | 43 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
47 | ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), | 44 | ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), |
48 | - ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')), | ||
49 | - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor')), | ||
50 | ], | 45 | ], |
51 | options={ | 46 | options={ |
52 | 'verbose_name': 'Log', | 47 | 'verbose_name': 'Log', |
@@ -73,8 +68,6 @@ class Migration(migrations.Migration): | @@ -73,8 +68,6 @@ class Migration(migrations.Migration): | ||
73 | ('read', models.BooleanField(default=False, verbose_name='Read')), | 68 | ('read', models.BooleanField(default=False, verbose_name='Read')), |
74 | ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), | 69 | ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), |
75 | ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')), | 70 | ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')), |
76 | - ('actor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notification_Performer', to=settings.AUTH_USER_MODEL, verbose_name='Perfomer')), | ||
77 | - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User')), | ||
78 | ], | 71 | ], |
79 | options={ | 72 | options={ |
80 | 'verbose_name': 'Notification', | 73 | 'verbose_name': 'Notification', |
@@ -95,9 +88,4 @@ class Migration(migrations.Migration): | @@ -95,9 +88,4 @@ class Migration(migrations.Migration): | ||
95 | 'verbose_name_plural': 'Resources', | 88 | 'verbose_name_plural': 'Resources', |
96 | }, | 89 | }, |
97 | ), | 90 | ), |
98 | - migrations.AddField( | ||
99 | - model_name='action_resource', | ||
100 | - name='resource', | ||
101 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Resource', verbose_name='Resource'), | ||
102 | - ), | ||
103 | ] | 91 | ] |
@@ -0,0 +1,50 @@ | @@ -0,0 +1,50 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-10-18 20:26 | ||
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 | + initial = True | ||
13 | + | ||
14 | + dependencies = [ | ||
15 | + ('core', '0001_initial'), | ||
16 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
17 | + ] | ||
18 | + | ||
19 | + operations = [ | ||
20 | + migrations.AddField( | ||
21 | + model_name='notification', | ||
22 | + name='actor', | ||
23 | + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notification_Performer', to=settings.AUTH_USER_MODEL, verbose_name='Perfomer'), | ||
24 | + ), | ||
25 | + migrations.AddField( | ||
26 | + model_name='notification', | ||
27 | + name='user', | ||
28 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User'), | ||
29 | + ), | ||
30 | + migrations.AddField( | ||
31 | + model_name='log', | ||
32 | + name='action_resource', | ||
33 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource'), | ||
34 | + ), | ||
35 | + migrations.AddField( | ||
36 | + model_name='log', | ||
37 | + name='user', | ||
38 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor'), | ||
39 | + ), | ||
40 | + migrations.AddField( | ||
41 | + model_name='action_resource', | ||
42 | + name='action', | ||
43 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied'), | ||
44 | + ), | ||
45 | + migrations.AddField( | ||
46 | + model_name='action_resource', | ||
47 | + name='resource', | ||
48 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Resource', verbose_name='Resource'), | ||
49 | + ), | ||
50 | + ] |
courses/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-18 02:46 | 2 | +# Generated by Django 1.10 on 2016-10-18 20:26 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | import autoslug.fields | 5 | import autoslug.fields |
6 | -from django.conf import settings | ||
7 | from django.db import migrations, models | 6 | from django.db import migrations, models |
8 | import django.db.models.deletion | 7 | import django.db.models.deletion |
9 | import s3direct.fields | 8 | import s3direct.fields |
@@ -15,7 +14,6 @@ class Migration(migrations.Migration): | @@ -15,7 +14,6 @@ class Migration(migrations.Migration): | ||
15 | 14 | ||
16 | dependencies = [ | 15 | dependencies = [ |
17 | ('core', '0001_initial'), | 16 | ('core', '0001_initial'), |
18 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
19 | ] | 17 | ] |
20 | 18 | ||
21 | operations = [ | 19 | operations = [ |
@@ -25,7 +23,6 @@ class Migration(migrations.Migration): | @@ -25,7 +23,6 @@ class Migration(migrations.Migration): | ||
25 | ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), | 23 | ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), |
26 | ('limit_date', models.DateField(verbose_name='Deliver Date')), | 24 | ('limit_date', models.DateField(verbose_name='Deliver Date')), |
27 | ('all_students', models.BooleanField(default=False, verbose_name='All Students')), | 25 | ('all_students', models.BooleanField(default=False, verbose_name='All Students')), |
28 | - ('students', models.ManyToManyField(related_name='activities', to=settings.AUTH_USER_MODEL, verbose_name='Students')), | ||
29 | ], | 26 | ], |
30 | bases=('core.resource',), | 27 | bases=('core.resource',), |
31 | ), | 28 | ), |
@@ -35,11 +32,10 @@ class Migration(migrations.Migration): | @@ -35,11 +32,10 @@ class Migration(migrations.Migration): | ||
35 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | 32 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
36 | ('pdf', s3direct.fields.S3DirectField()), | 33 | ('pdf', s3direct.fields.S3DirectField()), |
37 | ('name', models.CharField(max_length=100)), | 34 | ('name', models.CharField(max_length=100)), |
38 | - ('diet', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='courses.Activity')), | ||
39 | ], | 35 | ], |
40 | options={ | 36 | options={ |
41 | - 'verbose_name_plural': 'Activitys Files', | ||
42 | 'verbose_name': 'Activity File', | 37 | 'verbose_name': 'Activity File', |
38 | + 'verbose_name_plural': 'Activitys Files', | ||
43 | }, | 39 | }, |
44 | ), | 40 | ), |
45 | migrations.CreateModel( | 41 | migrations.CreateModel( |
@@ -51,8 +47,8 @@ class Migration(migrations.Migration): | @@ -51,8 +47,8 @@ class Migration(migrations.Migration): | ||
51 | ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), | 47 | ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), |
52 | ], | 48 | ], |
53 | options={ | 49 | options={ |
54 | - 'verbose_name_plural': 'Categories', | ||
55 | 'verbose_name': 'Category', | 50 | 'verbose_name': 'Category', |
51 | + 'verbose_name_plural': 'Categories', | ||
56 | }, | 52 | }, |
57 | ), | 53 | ), |
58 | migrations.CreateModel( | 54 | migrations.CreateModel( |
@@ -72,9 +68,9 @@ class Migration(migrations.Migration): | @@ -72,9 +68,9 @@ class Migration(migrations.Migration): | ||
72 | ('image', models.ImageField(blank=True, upload_to='courses/', verbose_name='Image')), | 68 | ('image', models.ImageField(blank=True, upload_to='courses/', verbose_name='Image')), |
73 | ], | 69 | ], |
74 | options={ | 70 | options={ |
71 | + 'verbose_name': 'Course', | ||
75 | 'verbose_name_plural': 'Courses', | 72 | 'verbose_name_plural': 'Courses', |
76 | 'ordering': ('create_date', 'name'), | 73 | 'ordering': ('create_date', 'name'), |
77 | - 'verbose_name': 'Course', | ||
78 | }, | 74 | }, |
79 | ), | 75 | ), |
80 | migrations.CreateModel( | 76 | migrations.CreateModel( |
@@ -86,8 +82,8 @@ class Migration(migrations.Migration): | @@ -86,8 +82,8 @@ class Migration(migrations.Migration): | ||
86 | ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), | 82 | ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), |
87 | ], | 83 | ], |
88 | options={ | 84 | options={ |
89 | - 'verbose_name_plural': 'Categories', | ||
90 | 'verbose_name': 'Category', | 85 | 'verbose_name': 'Category', |
86 | + 'verbose_name_plural': 'Categories', | ||
91 | }, | 87 | }, |
92 | ), | 88 | ), |
93 | migrations.CreateModel( | 89 | migrations.CreateModel( |
@@ -112,7 +108,6 @@ class Migration(migrations.Migration): | @@ -112,7 +108,6 @@ class Migration(migrations.Migration): | ||
112 | fields=[ | 108 | fields=[ |
113 | ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), | 109 | ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), |
114 | ('all_students', models.BooleanField(default=False, verbose_name='All Students')), | 110 | ('all_students', models.BooleanField(default=False, verbose_name='All Students')), |
115 | - ('students', models.ManyToManyField(related_name='materials', to=settings.AUTH_USER_MODEL, verbose_name='Students')), | ||
116 | ], | 111 | ], |
117 | bases=('core.resource',), | 112 | bases=('core.resource',), |
118 | ), | 113 | ), |
@@ -128,15 +123,11 @@ class Migration(migrations.Migration): | @@ -128,15 +123,11 @@ class Migration(migrations.Migration): | ||
128 | ('end_date', models.DateField(verbose_name='End of Subject Date')), | 123 | ('end_date', models.DateField(verbose_name='End of Subject Date')), |
129 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), | 124 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), |
130 | ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), | 125 | ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), |
131 | - ('category', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='subject_category', to='courses.CategorySubject', verbose_name='Category')), | ||
132 | - ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course')), | ||
133 | - ('professors', models.ManyToManyField(related_name='professors_subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors')), | ||
134 | - ('students', models.ManyToManyField(related_name='subject_student', to=settings.AUTH_USER_MODEL, verbose_name='Students')), | ||
135 | ], | 126 | ], |
136 | options={ | 127 | options={ |
128 | + 'verbose_name': 'Subject', | ||
137 | 'verbose_name_plural': 'Subjects', | 129 | 'verbose_name_plural': 'Subjects', |
138 | 'ordering': ('create_date', 'name'), | 130 | 'ordering': ('create_date', 'name'), |
139 | - 'verbose_name': 'Subject', | ||
140 | }, | 131 | }, |
141 | ), | 132 | ), |
142 | migrations.CreateModel( | 133 | migrations.CreateModel( |
@@ -146,11 +137,10 @@ class Migration(migrations.Migration): | @@ -146,11 +137,10 @@ class Migration(migrations.Migration): | ||
146 | ('name', models.CharField(max_length=100, verbose_name='Name')), | 137 | ('name', models.CharField(max_length=100, verbose_name='Name')), |
147 | ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), | 138 | ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), |
148 | ('description', models.TextField(blank=True, verbose_name='Description')), | 139 | ('description', models.TextField(blank=True, verbose_name='Description')), |
149 | - ('subjects', models.ManyToManyField(to='courses.Subject')), | ||
150 | ], | 140 | ], |
151 | options={ | 141 | options={ |
152 | - 'verbose_name_plural': 'subject categories', | ||
153 | 'verbose_name': 'subject category', | 142 | 'verbose_name': 'subject category', |
143 | + 'verbose_name_plural': 'subject categories', | ||
154 | }, | 144 | }, |
155 | ), | 145 | ), |
156 | migrations.CreateModel( | 146 | migrations.CreateModel( |
@@ -163,48 +153,11 @@ class Migration(migrations.Migration): | @@ -163,48 +153,11 @@ class Migration(migrations.Migration): | ||
163 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), | 153 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), |
164 | ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), | 154 | ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), |
165 | ('visible', models.BooleanField(default=False, verbose_name='Visible')), | 155 | ('visible', models.BooleanField(default=False, verbose_name='Visible')), |
166 | - ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Owner')), | ||
167 | - ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject')), | ||
168 | ], | 156 | ], |
169 | options={ | 157 | options={ |
158 | + 'verbose_name': 'Topic', | ||
170 | 'verbose_name_plural': 'Topics', | 159 | 'verbose_name_plural': 'Topics', |
171 | 'ordering': ('create_date', 'name'), | 160 | 'ordering': ('create_date', 'name'), |
172 | - 'verbose_name': 'Topic', | ||
173 | }, | 161 | }, |
174 | ), | 162 | ), |
175 | - migrations.AddField( | ||
176 | - model_name='material', | ||
177 | - name='topic', | ||
178 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'), | ||
179 | - ), | ||
180 | - migrations.AddField( | ||
181 | - model_name='linkmaterial', | ||
182 | - name='material', | ||
183 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_link', to='courses.Material', verbose_name='Material'), | ||
184 | - ), | ||
185 | - migrations.AddField( | ||
186 | - model_name='filematerial', | ||
187 | - name='material', | ||
188 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_file', to='courses.Material', verbose_name='Material'), | ||
189 | - ), | ||
190 | - migrations.AddField( | ||
191 | - model_name='course', | ||
192 | - name='category', | ||
193 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_category', to='courses.CourseCategory', verbose_name='Category'), | ||
194 | - ), | ||
195 | - migrations.AddField( | ||
196 | - model_name='course', | ||
197 | - name='professors', | ||
198 | - field=models.ManyToManyField(related_name='courses_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | ||
199 | - ), | ||
200 | - migrations.AddField( | ||
201 | - model_name='course', | ||
202 | - name='students', | ||
203 | - field=models.ManyToManyField(related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | ||
204 | - ), | ||
205 | - migrations.AddField( | ||
206 | - model_name='activity', | ||
207 | - name='topic', | ||
208 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'), | ||
209 | - ), | ||
210 | ] | 163 | ] |
@@ -0,0 +1,105 @@ | @@ -0,0 +1,105 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-10-18 20:26 | ||
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 | + initial = True | ||
13 | + | ||
14 | + dependencies = [ | ||
15 | + ('courses', '0001_initial'), | ||
16 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
17 | + ] | ||
18 | + | ||
19 | + operations = [ | ||
20 | + migrations.AddField( | ||
21 | + model_name='topic', | ||
22 | + name='owner', | ||
23 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Owner'), | ||
24 | + ), | ||
25 | + migrations.AddField( | ||
26 | + model_name='topic', | ||
27 | + name='subject', | ||
28 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject'), | ||
29 | + ), | ||
30 | + migrations.AddField( | ||
31 | + model_name='subjectcategory', | ||
32 | + name='subjects', | ||
33 | + field=models.ManyToManyField(to='courses.Subject'), | ||
34 | + ), | ||
35 | + migrations.AddField( | ||
36 | + model_name='subject', | ||
37 | + name='category', | ||
38 | + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='subject_category', to='courses.CategorySubject', verbose_name='Category'), | ||
39 | + ), | ||
40 | + migrations.AddField( | ||
41 | + model_name='subject', | ||
42 | + name='course', | ||
43 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course'), | ||
44 | + ), | ||
45 | + migrations.AddField( | ||
46 | + model_name='subject', | ||
47 | + name='professors', | ||
48 | + field=models.ManyToManyField(related_name='professors_subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | ||
49 | + ), | ||
50 | + migrations.AddField( | ||
51 | + model_name='subject', | ||
52 | + name='students', | ||
53 | + field=models.ManyToManyField(related_name='subject_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | ||
54 | + ), | ||
55 | + migrations.AddField( | ||
56 | + model_name='material', | ||
57 | + name='students', | ||
58 | + field=models.ManyToManyField(related_name='materials', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | ||
59 | + ), | ||
60 | + migrations.AddField( | ||
61 | + model_name='material', | ||
62 | + name='topic', | ||
63 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'), | ||
64 | + ), | ||
65 | + migrations.AddField( | ||
66 | + model_name='linkmaterial', | ||
67 | + name='material', | ||
68 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_link', to='courses.Material', verbose_name='Material'), | ||
69 | + ), | ||
70 | + migrations.AddField( | ||
71 | + model_name='filematerial', | ||
72 | + name='material', | ||
73 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_file', to='courses.Material', verbose_name='Material'), | ||
74 | + ), | ||
75 | + migrations.AddField( | ||
76 | + model_name='course', | ||
77 | + name='category', | ||
78 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_category', to='courses.CourseCategory', verbose_name='Category'), | ||
79 | + ), | ||
80 | + migrations.AddField( | ||
81 | + model_name='course', | ||
82 | + name='professors', | ||
83 | + field=models.ManyToManyField(related_name='courses_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | ||
84 | + ), | ||
85 | + migrations.AddField( | ||
86 | + model_name='course', | ||
87 | + name='students', | ||
88 | + field=models.ManyToManyField(related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | ||
89 | + ), | ||
90 | + migrations.AddField( | ||
91 | + model_name='activityfile', | ||
92 | + name='diet', | ||
93 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='courses.Activity'), | ||
94 | + ), | ||
95 | + migrations.AddField( | ||
96 | + model_name='activity', | ||
97 | + name='students', | ||
98 | + field=models.ManyToManyField(related_name='activities', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | ||
99 | + ), | ||
100 | + migrations.AddField( | ||
101 | + model_name='activity', | ||
102 | + name='topic', | ||
103 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'), | ||
104 | + ), | ||
105 | + ] |
courses/templates/subject/form_view_teacher.html
@@ -83,6 +83,8 @@ | @@ -83,6 +83,8 @@ | ||
83 | <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a> | 83 | <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a> |
84 | <ul class="dropdown-menu" aria-labelledby="dLabel"> | 84 | <ul class="dropdown-menu" aria-labelledby="dLabel"> |
85 | <li><a href="javascript:createForum('{% url 'course:forum:create' %}', '{{ topic.id }}')">{% trans 'Create Forum' %}<div class="ripple-container"><div class="ripple ripple-on ripple-out" style="left: 33.5312px; top: 11px; background-color: rgb(0, 150, 136); transform: scale(20);"></div></div></a></li> | 85 | <li><a href="javascript:createForum('{% url 'course:forum:create' %}', '{{ topic.id }}')">{% trans 'Create Forum' %}<div class="ripple-container"><div class="ripple ripple-on ripple-out" style="left: 33.5312px; top: 11px; background-color: rgb(0, 150, 136); transform: scale(20);"></div></div></a></li> |
86 | + <li><a href="javascript:modal.get('{% url 'course:poll:create_poll' topic.slug%}','#poll','#modal_poll');">{% trans 'Create Poll' %}</a></li> | ||
87 | + | ||
86 | </ul> | 88 | </ul> |
87 | </div> | 89 | </div> |
88 | </div> | 90 | </div> |
@@ -133,7 +135,6 @@ | @@ -133,7 +135,6 @@ | ||
133 | <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a> | 135 | <a href="#" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a> |
134 | <ul class="dropdown-menu" aria-labelledby="dLabel"> | 136 | <ul class="dropdown-menu" aria-labelledby="dLabel"> |
135 | <li>Qualquer coisa</li> | 137 | <li>Qualquer coisa</li> |
136 | - <li><i class="material-icons">poll</i> <a href="javascript:modal.get('{% url 'course:poll:create_poll' topic.slug%}','#poll','#modal_poll');">{% trans 'Create Poll' %}</a></li> | ||
137 | </ul> | 138 | </ul> |
138 | </div> | 139 | </div> |
139 | </div> | 140 | </div> |
@@ -0,0 +1,27 @@ | @@ -0,0 +1,27 @@ | ||
1 | +{% load static i18n list_topic_foruns permission_tags %} | ||
2 | +{% for link in links%} | ||
3 | + <li><i class="fa fa-link" aria-hidden="true"></i> <a href="#" data-toggle="modal" data-target="#linksModal{{slug}}{{ forloop.counter }}">{{link}}</a></li> | ||
4 | + <!--MODAL VIEW LINK--> | ||
5 | + <div class="modal fade" id="linksModal{{slug}}{{ forloop.counter}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
6 | + <div class="modal-dialog" role="document"> | ||
7 | + <div class="modal-content"> | ||
8 | + <div class="modal-header"> | ||
9 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
10 | + <h4 class="modal-title" id="myModalLabel">Link</h4> | ||
11 | + </div> | ||
12 | + <div class="modal-body"> | ||
13 | + <!-- Card --> | ||
14 | + <article class="card animated fadeInLeft"> | ||
15 | + <div class="card-block"> | ||
16 | + <b class="card-title">{{link.name}}</b><p></p> | ||
17 | + <p class="card-text"> </p><p>{{link.link_description}}</p> | ||
18 | + <a href="{{ link.link_url }}" class="btn btn-primary">Read more</a> | ||
19 | + </div> | ||
20 | + </article> | ||
21 | + <!-- .end Card --> | ||
22 | + </div> | ||
23 | + </div> | ||
24 | + </div> | ||
25 | + </div> | ||
26 | + <!-- EndModal --> | ||
27 | +{% endfor %} |
@@ -0,0 +1,31 @@ | @@ -0,0 +1,31 @@ | ||
1 | +{% load static i18n list_topic_foruns permission_tags %} | ||
2 | +{% for link in links%} | ||
3 | + <li class="icon_edit_remove"> <a href="#" data-toggle="modal" data-target="#linksModalEdit"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a> <a href="#" data-toggle="modal" data-target="#removeLink"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a></li> | ||
4 | + <li><i class="fa fa-link" aria-hidden="true"></i> <a href="#" data-toggle="modal" data-target="#linksModal{{slug}}{{ forloop.counter }}">{{link}}</a></li> | ||
5 | + | ||
6 | + <!--MODAL VIEW LINK--> | ||
7 | + <div class="modal fade" id="linksModal{{slug}}{{ forloop.counter}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
8 | + <div class="modal-dialog" role="document"> | ||
9 | + <div class="modal-content"> | ||
10 | + <div class="modal-header"> | ||
11 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
12 | + <h4 class="modal-title" id="myModalLabel">Link</h4> | ||
13 | + </div> | ||
14 | + <div class="modal-body"> | ||
15 | + <!-- Card --> | ||
16 | + <article class="card animated fadeInLeft"> | ||
17 | + <div class="card-block"> | ||
18 | + <b class="card-title">{{link.name}}</b><p></p> | ||
19 | + <p class="card-text"> </p><p>{{link.link_description}}</p> | ||
20 | + <a href="{{ link.link_url }}" class="btn btn-primary">Read more</a> | ||
21 | + </div> | ||
22 | + </article> | ||
23 | + <!-- .end Card --> | ||
24 | + </div> | ||
25 | + </div> | ||
26 | + </div> | ||
27 | + </div> | ||
28 | + <!-- EndModal --> | ||
29 | +{% endfor %} | ||
30 | + <div class = "row" id="divModalLink"> | ||
31 | + </div> |
courses/templatetags/list_topic_foruns.py
1 | from django import template | 1 | from django import template |
2 | 2 | ||
3 | +from links.models import Link | ||
3 | from forum.models import Forum | 4 | from forum.models import Forum |
4 | from poll.models import Poll | 5 | from poll.models import Poll |
5 | from files.models import TopicFile | 6 | from files.models import TopicFile |
@@ -51,3 +52,21 @@ def list_topic_file_edit(request, topic): | @@ -51,3 +52,21 @@ def list_topic_file_edit(request, topic): | ||
51 | context['topic'] = topic | 52 | context['topic'] = topic |
52 | 53 | ||
53 | return context | 54 | return context |
55 | + | ||
56 | +@register.inclusion_tag('topic/link_topic_list_edit.html') | ||
57 | +def list_topic_link_edit(request,topic): | ||
58 | + context = { | ||
59 | + 'request':request | ||
60 | + } | ||
61 | + context['links'] = Link.objects.filter(topic = topic) | ||
62 | + context['slug'] = topic.slug | ||
63 | + return context | ||
64 | + | ||
65 | +@register.inclusion_tag('topic/link_topic_list.html') | ||
66 | +def list_topic_link(request,topic): | ||
67 | + context = { | ||
68 | + 'request':request | ||
69 | + } | ||
70 | + context['links'] = Link.objects.filter(topic = topic) | ||
71 | + context['slug'] = topic.slug | ||
72 | + return context |
courses/urls.py
@@ -30,6 +30,7 @@ urlpatterns = [ | @@ -30,6 +30,7 @@ urlpatterns = [ | ||
30 | url(r'^exam/', include('exam.urls', namespace = 'exam')), | 30 | url(r'^exam/', include('exam.urls', namespace = 'exam')), |
31 | url(r'^files/', include('files.urls', namespace = 'file')), | 31 | url(r'^files/', include('files.urls', namespace = 'file')), |
32 | url(r'^upload-material/$', views.UploadMaterialView.as_view(), name='upload_material'), | 32 | url(r'^upload-material/$', views.UploadMaterialView.as_view(), name='upload_material'), |
33 | + url(r'^links/',include('links.urls',namespace = 'links')), | ||
33 | 34 | ||
34 | 35 | ||
35 | 36 |
exam/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-18 02:47 | 2 | +# Generated by Django 1.10 on 2016-10-18 20:26 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | from django.db import migrations, models | 5 | from django.db import migrations, models |
@@ -23,8 +23,8 @@ class Migration(migrations.Migration): | @@ -23,8 +23,8 @@ class Migration(migrations.Migration): | ||
23 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), | 23 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), |
24 | ], | 24 | ], |
25 | options={ | 25 | options={ |
26 | - 'verbose_name_plural': 'Answers', | ||
27 | 'verbose_name': 'Answer', | 26 | 'verbose_name': 'Answer', |
27 | + 'verbose_name_plural': 'Answers', | ||
28 | 'ordering': ('order',), | 28 | 'ordering': ('order',), |
29 | }, | 29 | }, |
30 | ), | 30 | ), |
@@ -35,8 +35,8 @@ class Migration(migrations.Migration): | @@ -35,8 +35,8 @@ class Migration(migrations.Migration): | ||
35 | ('begin_date', models.DateField(blank=True, verbose_name='Begin of Course Date')), | 35 | ('begin_date', models.DateField(blank=True, verbose_name='Begin of Course Date')), |
36 | ], | 36 | ], |
37 | options={ | 37 | options={ |
38 | - 'verbose_name_plural': 'Exams', | ||
39 | 'verbose_name': 'Exam', | 38 | 'verbose_name': 'Exam', |
39 | + 'verbose_name_plural': 'Exams', | ||
40 | }, | 40 | }, |
41 | bases=('courses.activity',), | 41 | bases=('courses.activity',), |
42 | ), | 42 | ), |
files/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-18 02:47 | 2 | +# Generated by Django 1.10 on 2016-10-18 20:26 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | -from django.conf import settings | ||
6 | from django.db import migrations, models | 5 | from django.db import migrations, models |
7 | import django.db.models.deletion | 6 | import django.db.models.deletion |
8 | import files.models | 7 | import files.models |
@@ -13,9 +12,8 @@ class Migration(migrations.Migration): | @@ -13,9 +12,8 @@ class Migration(migrations.Migration): | ||
13 | initial = True | 12 | initial = True |
14 | 13 | ||
15 | dependencies = [ | 14 | dependencies = [ |
16 | - ('courses', '0001_initial'), | ||
17 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
18 | ('core', '0001_initial'), | 15 | ('core', '0001_initial'), |
16 | + ('courses', '0001_initial'), | ||
19 | ] | 17 | ] |
20 | 18 | ||
21 | operations = [ | 19 | operations = [ |
@@ -26,11 +24,10 @@ class Migration(migrations.Migration): | @@ -26,11 +24,10 @@ class Migration(migrations.Migration): | ||
26 | ('description', models.TextField(blank=True, verbose_name='Description')), | 24 | ('description', models.TextField(blank=True, verbose_name='Description')), |
27 | ('file_url', models.FileField(upload_to=files.models.file_path, verbose_name='File')), | 25 | ('file_url', models.FileField(upload_to=files.models.file_path, verbose_name='File')), |
28 | ('file_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topic_files', to='core.MimeType', verbose_name='Type file')), | 26 | ('file_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topic_files', to='core.MimeType', verbose_name='Type file')), |
29 | - ('professor', models.ManyToManyField(related_name='file_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors')), | ||
30 | ], | 27 | ], |
31 | options={ | 28 | options={ |
32 | - 'verbose_name_plural': 'Files', | ||
33 | 'verbose_name': 'File', | 29 | 'verbose_name': 'File', |
30 | + 'verbose_name_plural': 'Files', | ||
34 | 'ordering': ('-id',), | 31 | 'ordering': ('-id',), |
35 | }, | 32 | }, |
36 | bases=('courses.material',), | 33 | bases=('courses.material',), |
@@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-10-18 20:26 | ||
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 | + initial = True | ||
12 | + | ||
13 | + dependencies = [ | ||
14 | + ('files', '0001_initial'), | ||
15 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
16 | + ] | ||
17 | + | ||
18 | + operations = [ | ||
19 | + migrations.AddField( | ||
20 | + model_name='topicfile', | ||
21 | + name='professor', | ||
22 | + field=models.ManyToManyField(related_name='file_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | ||
23 | + ), | ||
24 | + ] |
forum/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-18 02:48 | 2 | +# Generated by Django 1.10 on 2016-10-18 20:26 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | -from django.conf import settings | ||
6 | from django.db import migrations, models | 5 | from django.db import migrations, models |
7 | import django.db.models.deletion | 6 | import django.db.models.deletion |
8 | 7 | ||
@@ -12,7 +11,6 @@ class Migration(migrations.Migration): | @@ -12,7 +11,6 @@ class Migration(migrations.Migration): | ||
12 | initial = True | 11 | initial = True |
13 | 12 | ||
14 | dependencies = [ | 13 | dependencies = [ |
15 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
16 | ('courses', '0001_initial'), | 14 | ('courses', '0001_initial'), |
17 | ] | 15 | ] |
18 | 16 | ||
@@ -38,8 +36,6 @@ class Migration(migrations.Migration): | @@ -38,8 +36,6 @@ class Migration(migrations.Migration): | ||
38 | ('message', models.TextField(verbose_name='Post message')), | 36 | ('message', models.TextField(verbose_name='Post message')), |
39 | ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), | 37 | ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), |
40 | ('post_date', models.DateTimeField(auto_now_add=True, verbose_name='Post Date')), | 38 | ('post_date', models.DateTimeField(auto_now_add=True, verbose_name='Post Date')), |
41 | - ('forum', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Forum', verbose_name='Forum')), | ||
42 | - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor')), | ||
43 | ], | 39 | ], |
44 | options={ | 40 | options={ |
45 | 'verbose_name': 'Post', | 41 | 'verbose_name': 'Post', |
@@ -54,7 +50,6 @@ class Migration(migrations.Migration): | @@ -54,7 +50,6 @@ class Migration(migrations.Migration): | ||
54 | ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), | 50 | ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), |
55 | ('answer_date', models.DateTimeField(auto_now_add=True, verbose_name='Answer Date')), | 51 | ('answer_date', models.DateTimeField(auto_now_add=True, verbose_name='Answer Date')), |
56 | ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Post', verbose_name='Post')), | 52 | ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Post', verbose_name='Post')), |
57 | - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor')), | ||
58 | ], | 53 | ], |
59 | options={ | 54 | options={ |
60 | 'verbose_name': 'Post Answer', | 55 | 'verbose_name': 'Post Answer', |
@@ -0,0 +1,35 @@ | @@ -0,0 +1,35 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-10-18 20:26 | ||
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 | + initial = True | ||
13 | + | ||
14 | + dependencies = [ | ||
15 | + ('forum', '0001_initial'), | ||
16 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
17 | + ] | ||
18 | + | ||
19 | + operations = [ | ||
20 | + migrations.AddField( | ||
21 | + model_name='postanswer', | ||
22 | + name='user', | ||
23 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor'), | ||
24 | + ), | ||
25 | + migrations.AddField( | ||
26 | + model_name='post', | ||
27 | + name='forum', | ||
28 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Forum', verbose_name='Forum'), | ||
29 | + ), | ||
30 | + migrations.AddField( | ||
31 | + model_name='post', | ||
32 | + name='user', | ||
33 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor'), | ||
34 | + ), | ||
35 | + ] |
forum/tests/test_model_answer.py
@@ -93,16 +93,26 @@ class PostAnswerTestCase (TestCase): | @@ -93,16 +93,26 @@ class PostAnswerTestCase (TestCase): | ||
93 | ) | 93 | ) |
94 | self.post_student.save() | 94 | self.post_student.save() |
95 | 95 | ||
96 | - self.answer = PostAnswer.objects.create( | 96 | + self.answerStudent = PostAnswer.objects.create( |
97 | user = self.user_student, | 97 | user = self.user_student, |
98 | post = self.post_professor, | 98 | post = self.post_professor, |
99 | message = 'testing a post answer', | 99 | message = 'testing a post answer', |
100 | modification_date = '2016-10-05', | 100 | modification_date = '2016-10-05', |
101 | answer_date = '2016-10-04', | 101 | answer_date = '2016-10-04', |
102 | ) | 102 | ) |
103 | - self.answer.save() | 103 | + self.answerStudent.save() |
104 | + | ||
105 | + self.answerProfessor = PostAnswer.objects.create( | ||
106 | + user = self.user_professor, | ||
107 | + post = self.post_student, | ||
108 | + message = 'testing a post answer', | ||
109 | + modification_date = '2016-10-05', | ||
110 | + answer_date = '2016-10-04', | ||
111 | + ) | ||
112 | + self.answerProfessor.save() | ||
104 | 113 | ||
105 | def test_create_answer_post (self): | 114 | def test_create_answer_post (self): |
115 | + list_answers = PostAnswer.objects.filter(user=self.user_professor).count() | ||
106 | answer = PostAnswer.objects.create( | 116 | answer = PostAnswer.objects.create( |
107 | user = self.user_professor, | 117 | user = self.user_professor, |
108 | post = self.post_student, | 118 | post = self.post_student, |
@@ -112,19 +122,46 @@ class PostAnswerTestCase (TestCase): | @@ -112,19 +122,46 @@ class PostAnswerTestCase (TestCase): | ||
112 | ) | 122 | ) |
113 | answer.save() | 123 | answer.save() |
114 | 124 | ||
115 | - self.assertEquals (answer, PostAnswer.objects.get(user=self.user_professor, post=self.post_student)) | 125 | + self.assertEquals (list_answers+1, PostAnswer.objects.filter(user=self.user_professor, post=self.post_student).count()) |
126 | + | ||
127 | + list_answers = PostAnswer.objects.filter(user=self.user_student).count() | ||
128 | + answer = PostAnswer.objects.create( | ||
129 | + user = self.user_student, | ||
130 | + post = self.post_professor, | ||
131 | + message = 'testing a post answer2', | ||
132 | + modification_date = '2016-10-05', | ||
133 | + answer_date = '2016-10-04', | ||
134 | + ) | ||
135 | + answer.save() | ||
136 | + | ||
137 | + self.assertEquals (list_answers+1, PostAnswer.objects.filter(user=self.user_student, post=self.post_professor).count()) | ||
116 | 138 | ||
117 | def test_update_answer_post (self): | 139 | def test_update_answer_post (self): |
118 | - self.answer.message = 'updating a answer post' | ||
119 | - self.answer.save() | 140 | + self.answerStudent.message = 'updating a student answer post' |
141 | + self.answerStudent.save() | ||
142 | + answer = PostAnswer.objects.get(message='updating a student answer post') | ||
120 | 143 | ||
121 | - self.assertEquals(self.answer, PostAnswer.objects.all()[0]) | 144 | + self.assertEquals(self.answerStudent, answer) |
122 | 145 | ||
123 | - def test_delete_answer_post (self): | ||
124 | - answer = PostAnswer.objects.get(user=self.user_student, post=self.post_professor) | ||
125 | - self.answer.delete() | ||
126 | 146 | ||
127 | - try: | ||
128 | - answer = PostAnswer.objects.get(user=self.user_student, post=self.post_professor) | ||
129 | - except: | ||
130 | - pass | ||
131 | \ No newline at end of file | 147 | \ No newline at end of file |
148 | + self.answerProfessor.message = 'updating a professor answer post' | ||
149 | + self.answerProfessor.save() | ||
150 | + answer = PostAnswer.objects.get(message='updating a professor answer post') | ||
151 | + | ||
152 | + self.assertEquals(self.answerProfessor, answer) | ||
153 | + | ||
154 | + def test_delete_answer_post (self): | ||
155 | + list_studentAnswers = PostAnswer.objects.filter(user=self.user_student).count() | ||
156 | + self.assertEquals(list_studentAnswers, 1) | ||
157 | + | ||
158 | + self.answerStudent.delete() | ||
159 | + list_studentAnswers = PostAnswer.objects.filter(user=self.user_student).count() | ||
160 | + self.assertEquals(list_studentAnswers, 0) | ||
161 | + | ||
162 | + list_professorAnswers = PostAnswer.objects.filter(user=self.user_professor).count() | ||
163 | + self.assertEquals(list_professorAnswers, 1) | ||
164 | + | ||
165 | + self.answerProfessor.delete() | ||
166 | + list_professorAnswers = PostAnswer.objects.filter(user=self.user_professor).count() | ||
167 | + self.assertEquals(list_professorAnswers, 0) | ||
168 | + | ||
132 | \ No newline at end of file | 169 | \ No newline at end of file |
forum/tests/test_model_forum.py
@@ -77,7 +77,9 @@ class ForumTestCase (TestCase): | @@ -77,7 +77,9 @@ class ForumTestCase (TestCase): | ||
77 | self.forum.save() | 77 | self.forum.save() |
78 | 78 | ||
79 | def test_create_forum (self): | 79 | def test_create_forum (self): |
80 | - forum = Forum.objects.create( | 80 | + list_forum = Forum.objects.all().count() |
81 | + | ||
82 | + forum = Forum.objects.create( | ||
81 | topic=self.topic, | 83 | topic=self.topic, |
82 | name = 'forum test2', | 84 | name = 'forum test2', |
83 | description = 'description of the forum test', | 85 | description = 'description of the forum test', |
@@ -85,22 +87,20 @@ class ForumTestCase (TestCase): | @@ -85,22 +87,20 @@ class ForumTestCase (TestCase): | ||
85 | modification_date = '2016-10-03', | 87 | modification_date = '2016-10-03', |
86 | limit_date = '2017-10-05', | 88 | limit_date = '2017-10-05', |
87 | ) | 89 | ) |
88 | - forum.save() | 90 | + forum.save() |
89 | 91 | ||
90 | - self.assertEquals(forum, Forum.objects.filter(name='forum test2')[0]) | 92 | + self.assertEquals(list_forum+1, Forum.objects.all().count()) |
91 | 93 | ||
92 | - def test_update_forum(self): | 94 | + def test_update_forum(self): |
95 | + list_forum = Forum.objects.all().count() | ||
93 | self.forum.name = 'forum test updated' | 96 | self.forum.name = 'forum test updated' |
94 | self.forum.save() | 97 | self.forum.save() |
95 | 98 | ||
96 | self.assertEquals(self.forum, Forum.objects.get(name='forum test updated')) | 99 | self.assertEquals(self.forum, Forum.objects.get(name='forum test updated')) |
100 | + self.assertEquals(list_forum, Forum.objects.all().count()) | ||
97 | 101 | ||
98 | def test_delete_forum (self): | 102 | def test_delete_forum (self): |
99 | - forum = Forum.objects.get(name='forum test') | 103 | + list_forum = Forum.objects.all().count() |
100 | self.forum.delete() | 104 | self.forum.delete() |
101 | 105 | ||
102 | - try: | ||
103 | - forum = Forum.objects.get(name='forum test') | ||
104 | - except: | ||
105 | - pass | ||
106 | - | ||
107 | \ No newline at end of file | 106 | \ No newline at end of file |
107 | + self.assertEquals(list_forum-1, Forum.objects.all().count()) | ||
108 | \ No newline at end of file | 108 | \ No newline at end of file |
forum/tests/test_model_post.py
@@ -94,6 +94,8 @@ class PostTestCase (TestCase): | @@ -94,6 +94,8 @@ class PostTestCase (TestCase): | ||
94 | self.post_student.save() | 94 | self.post_student.save() |
95 | 95 | ||
96 | def test_create_post_professor (self): | 96 | def test_create_post_professor (self): |
97 | + list_post = Post.objects.all().count() | ||
98 | + | ||
97 | post_professor = Post.objects.create( | 99 | post_professor = Post.objects.create( |
98 | user = self.user_professor, | 100 | user = self.user_professor, |
99 | message = 'posting', | 101 | message = 'posting', |
@@ -103,9 +105,11 @@ class PostTestCase (TestCase): | @@ -103,9 +105,11 @@ class PostTestCase (TestCase): | ||
103 | ) | 105 | ) |
104 | post_professor.save() | 106 | post_professor.save() |
105 | 107 | ||
106 | - self.assertEquals (post_professor, Post.objects.get(user=self.user_professor, message='posting')) | 108 | + self.assertEquals(list_post+1, Post.objects.all().count()) |
107 | 109 | ||
108 | def test_create_post_student (self): | 110 | def test_create_post_student (self): |
111 | + list_post = Post.objects.all().count() | ||
112 | + | ||
109 | post_student = Post.objects.create( | 113 | post_student = Post.objects.create( |
110 | user = self.user_student, | 114 | user = self.user_student, |
111 | message = 'posting', | 115 | message = 'posting', |
@@ -115,34 +119,35 @@ class PostTestCase (TestCase): | @@ -115,34 +119,35 @@ class PostTestCase (TestCase): | ||
115 | ) | 119 | ) |
116 | post_student.save() | 120 | post_student.save() |
117 | 121 | ||
118 | - self.assertEquals (post_student, Post.objects.get(user=self.user_student, message='posting')) | 122 | + self.assertEquals(list_post+1, Post.objects.all().count()) |
119 | 123 | ||
120 | def test_update_post_professor (self): | 124 | def test_update_post_professor (self): |
125 | + list_post = Post.objects.all().count() | ||
121 | self.post_professor.message = 'updating a post as professor' | 126 | self.post_professor.message = 'updating a post as professor' |
122 | self.post_professor.save() | 127 | self.post_professor.save() |
123 | 128 | ||
124 | - self.assertEquals(self.post_professor, Post.objects.all()[1]) | 129 | + self.assertEquals(self.post_professor, Post.objects.get(message='updating a post as professor')) |
130 | + self.assertEquals(list_post, Post.objects.all().count()) | ||
125 | 131 | ||
126 | def test_update_post_student (self): | 132 | def test_update_post_student (self): |
133 | + list_post = Post.objects.all().count() | ||
127 | self.post_student.message = 'updating a post as student' | 134 | self.post_student.message = 'updating a post as student' |
128 | self.post_student.save() | 135 | self.post_student.save() |
129 | 136 | ||
130 | - self.assertEquals(self.post_student, Post.objects.all()[1]) | 137 | + self.assertEquals(self.post_student, Post.objects.get(message='updating a post as student')) |
138 | + self.assertEquals(list_post, Post.objects.all().count()) | ||
131 | 139 | ||
132 | def test_delete_post_professor (self): | 140 | def test_delete_post_professor (self): |
141 | + list_post = Post.objects.all().count() | ||
142 | + | ||
133 | post = Post.objects.get(user=self.user_professor, message='posting a test on forum as professor') | 143 | post = Post.objects.get(user=self.user_professor, message='posting a test on forum as professor') |
134 | self.post_professor.delete() | 144 | self.post_professor.delete() |
135 | 145 | ||
136 | - try: | ||
137 | - post = Post.objects.get(user=self.user_professor, message='posting a test on forum as professor') | ||
138 | - except: | ||
139 | - pass | 146 | + self.assertEquals(list_post-1, Post.objects.all().count()) |
140 | 147 | ||
141 | def test_delete_post_student (self): | 148 | def test_delete_post_student (self): |
149 | + list_post = Post.objects.all().count() | ||
142 | post = Post.objects.get(user=self.user_student, message='posting a test on forum as student') | 150 | post = Post.objects.get(user=self.user_student, message='posting a test on forum as student') |
143 | self.post_student.delete() | 151 | self.post_student.delete() |
144 | 152 | ||
145 | - try: | ||
146 | - post = Post.objects.get(user=self.user_student, message='posting a test on forum as student') | ||
147 | - except: | ||
148 | - pass | ||
149 | \ No newline at end of file | 153 | \ No newline at end of file |
154 | + self.assertEquals(list_post-1, Post.objects.all().count()) | ||
150 | \ No newline at end of file | 155 | \ No newline at end of file |
links/admin.py
@@ -3,8 +3,8 @@ from django.contrib import admin | @@ -3,8 +3,8 @@ from django.contrib import admin | ||
3 | from .models import Link | 3 | from .models import Link |
4 | 4 | ||
5 | class LinkAdmin(admin.ModelAdmin): | 5 | class LinkAdmin(admin.ModelAdmin): |
6 | - list_display = ['name', 'link','description'] | ||
7 | - search_fields = ['name', 'link','description'] | 6 | + list_display = ['name', 'link_url','link_description'] |
7 | + search_fields = ['name', 'link_url','link_description'] | ||
8 | 8 | ||
9 | 9 | ||
10 | admin.site.register(Link, LinkAdmin) | 10 | admin.site.register(Link, LinkAdmin) |
links/forms.py
@@ -5,16 +5,16 @@ import validators | @@ -5,16 +5,16 @@ import validators | ||
5 | class CreateLinkForm(forms.ModelForm): | 5 | class CreateLinkForm(forms.ModelForm): |
6 | 6 | ||
7 | def clean_link(self): | 7 | def clean_link(self): |
8 | - link = self.cleaned_data['link'] | ||
9 | - if not validators.url(link): | 8 | + link_url = self.cleaned_data['link_url'] |
9 | + if not validators.url(link_url): | ||
10 | raise forms.ValidationError(_('Please enter a valid URL')) | 10 | raise forms.ValidationError(_('Please enter a valid URL')) |
11 | - return link | 11 | + return link_url |
12 | 12 | ||
13 | class Meta: | 13 | class Meta: |
14 | model = Link | 14 | model = Link |
15 | - fields = ['name','link','description'] | 15 | + fields = ['name','link_url','link_description'] |
16 | 16 | ||
17 | class UpdateLinkForm(forms.ModelForm): | 17 | class UpdateLinkForm(forms.ModelForm): |
18 | class Meta: | 18 | class Meta: |
19 | model = Link | 19 | model = Link |
20 | - fields = ['name','link','description'] | 20 | + fields = ['name','link_url','link_description'] |
links/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-18 02:47 | 2 | +# Generated by Django 1.10 on 2016-10-18 20:26 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | from django.db import migrations, models | 5 | from django.db import migrations, models |
6 | +import django.db.models.deletion | ||
6 | 7 | ||
7 | 8 | ||
8 | class Migration(migrations.Migration): | 9 | class Migration(migrations.Migration): |
@@ -10,20 +11,21 @@ class Migration(migrations.Migration): | @@ -10,20 +11,21 @@ class Migration(migrations.Migration): | ||
10 | initial = True | 11 | initial = True |
11 | 12 | ||
12 | dependencies = [ | 13 | dependencies = [ |
14 | + ('courses', '0001_initial'), | ||
13 | ] | 15 | ] |
14 | 16 | ||
15 | operations = [ | 17 | operations = [ |
16 | migrations.CreateModel( | 18 | migrations.CreateModel( |
17 | name='Link', | 19 | name='Link', |
18 | fields=[ | 20 | fields=[ |
19 | - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
20 | - ('name', models.CharField(max_length=100)), | ||
21 | - ('link', models.URLField()), | ||
22 | - ('description', models.CharField(max_length=200)), | 21 | + ('material_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='courses.Material')), |
22 | + ('link_url', models.URLField()), | ||
23 | + ('link_description', models.CharField(max_length=200)), | ||
23 | ], | 24 | ], |
24 | options={ | 25 | options={ |
25 | - 'verbose_name_plural': 'Links', | ||
26 | 'verbose_name': 'Link', | 26 | 'verbose_name': 'Link', |
27 | + 'verbose_name_plural': 'Links', | ||
27 | }, | 28 | }, |
29 | + bases=('courses.material',), | ||
28 | ), | 30 | ), |
29 | ] | 31 | ] |
links/models.py
1 | - | ||
2 | from django.db import models | 1 | from django.db import models |
3 | from courses.models import Material | 2 | from courses.models import Material |
4 | from autoslug.fields import AutoSlugField | 3 | from autoslug.fields import AutoSlugField |
5 | # Create your models here. | 4 | # Create your models here. |
6 | -class Link(models.Model): | ||
7 | - name = models.CharField(max_length=100) | ||
8 | - link = models.URLField() | ||
9 | - description = models.CharField(max_length=200) | 5 | +class Link(Material): |
6 | + link_url = models.URLField() | ||
7 | + link_description = models.CharField(max_length=200) | ||
10 | class Meta: | 8 | class Meta: |
11 | verbose_name = 'Link' | 9 | verbose_name = 'Link' |
12 | verbose_name_plural = "Links" | 10 | verbose_name_plural = "Links" |
links/urls.py
@@ -2,5 +2,7 @@ from django.conf.urls import url, include | @@ -2,5 +2,7 @@ from django.conf.urls import url, include | ||
2 | from . import views | 2 | from . import views |
3 | 3 | ||
4 | urlpatterns = [ | 4 | urlpatterns = [ |
5 | - url(r'^$', views.CreateLink.as_view(), name='teste') | 5 | + url(r'^$', views.CreateLink.as_view(), name='create_link'), |
6 | + url(r'^deletelink/(?P<linkname>[\w_-]+)/$', views.deleteLink,name = 'delete_link'), | ||
7 | + url(r'^updatelink/(?P<linkname>[\w_-]+)/$', views.UpdateLink.as_view(),name = 'update_link'), | ||
6 | ] | 8 | ] |
links/views.py
@@ -13,7 +13,7 @@ class CreateLink(generic.CreateView): | @@ -13,7 +13,7 @@ class CreateLink(generic.CreateView): | ||
13 | template_name = 'links/create_link.html' | 13 | template_name = 'links/create_link.html' |
14 | form_class = CreateLinkForm | 14 | form_class = CreateLinkForm |
15 | success_url = reverse_lazy('course:manage') | 15 | success_url = reverse_lazy('course:manage') |
16 | - context_object_name = 'links' | 16 | + context_object_name = 'form' |
17 | 17 | ||
18 | def form_valid(self, form): | 18 | def form_valid(self, form): |
19 | form.save() | 19 | form.save() |
@@ -26,7 +26,6 @@ class CreateLink(generic.CreateView): | @@ -26,7 +26,6 @@ class CreateLink(generic.CreateView): | ||
26 | context['form'] = CreateLinkForm | 26 | context['form'] = CreateLinkForm |
27 | return context | 27 | return context |
28 | 28 | ||
29 | - | ||
30 | def deleteLink(request,linkname): | 29 | def deleteLink(request,linkname): |
31 | link = get_object_or_404(Link,name = linkname) | 30 | link = get_object_or_404(Link,name = linkname) |
32 | link.delete() | 31 | link.delete() |
poll/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-18 02:47 | 2 | +# Generated by Django 1.10 on 2016-10-18 20:26 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | -from django.conf import settings | ||
6 | from django.db import migrations, models | 5 | from django.db import migrations, models |
7 | import django.db.models.deletion | 6 | import django.db.models.deletion |
8 | 7 | ||
@@ -13,7 +12,6 @@ class Migration(migrations.Migration): | @@ -13,7 +12,6 @@ class Migration(migrations.Migration): | ||
13 | 12 | ||
14 | dependencies = [ | 13 | dependencies = [ |
15 | ('courses', '0001_initial'), | 14 | ('courses', '0001_initial'), |
16 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
17 | ] | 15 | ] |
18 | 16 | ||
19 | operations = [ | 17 | operations = [ |
@@ -25,8 +23,8 @@ class Migration(migrations.Migration): | @@ -25,8 +23,8 @@ class Migration(migrations.Migration): | ||
25 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), | 23 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), |
26 | ], | 24 | ], |
27 | options={ | 25 | options={ |
28 | - 'verbose_name_plural': 'Answers', | ||
29 | 'verbose_name': 'Answer', | 26 | 'verbose_name': 'Answer', |
27 | + 'verbose_name_plural': 'Answers', | ||
30 | 'ordering': ('order',), | 28 | 'ordering': ('order',), |
31 | }, | 29 | }, |
32 | ), | 30 | ), |
@@ -39,8 +37,8 @@ class Migration(migrations.Migration): | @@ -39,8 +37,8 @@ class Migration(migrations.Migration): | ||
39 | ('answer', models.ManyToManyField(related_name='answers_stundet', to='poll.Answer', verbose_name='Answers Students')), | 37 | ('answer', models.ManyToManyField(related_name='answers_stundet', to='poll.Answer', verbose_name='Answers Students')), |
40 | ], | 38 | ], |
41 | options={ | 39 | options={ |
42 | - 'verbose_name_plural': 'Answers Student', | ||
43 | 'verbose_name': 'Answer Stundent', | 40 | 'verbose_name': 'Answer Stundent', |
41 | + 'verbose_name_plural': 'Answers Student', | ||
44 | }, | 42 | }, |
45 | ), | 43 | ), |
46 | migrations.CreateModel( | 44 | migrations.CreateModel( |
@@ -49,8 +47,8 @@ class Migration(migrations.Migration): | @@ -49,8 +47,8 @@ class Migration(migrations.Migration): | ||
49 | ('activity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='courses.Activity')), | 47 | ('activity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='courses.Activity')), |
50 | ], | 48 | ], |
51 | options={ | 49 | options={ |
52 | - 'verbose_name_plural': 'Polls', | ||
53 | 'verbose_name': 'Poll', | 50 | 'verbose_name': 'Poll', |
51 | + 'verbose_name_plural': 'Polls', | ||
54 | }, | 52 | }, |
55 | bases=('courses.activity',), | 53 | bases=('courses.activity',), |
56 | ), | 54 | ), |
@@ -59,14 +57,4 @@ class Migration(migrations.Migration): | @@ -59,14 +57,4 @@ class Migration(migrations.Migration): | ||
59 | name='poll', | 57 | name='poll', |
60 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers_stundet', to='poll.Poll', verbose_name='Poll'), | 58 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers_stundet', to='poll.Poll', verbose_name='Poll'), |
61 | ), | 59 | ), |
62 | - migrations.AddField( | ||
63 | - model_name='answersstudent', | ||
64 | - name='student', | ||
65 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers_stundent', to=settings.AUTH_USER_MODEL, verbose_name='Student'), | ||
66 | - ), | ||
67 | - migrations.AddField( | ||
68 | - model_name='answer', | ||
69 | - name='poll', | ||
70 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='poll.Poll', verbose_name='Answers'), | ||
71 | - ), | ||
72 | ] | 60 | ] |
@@ -0,0 +1,30 @@ | @@ -0,0 +1,30 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-10-18 20:26 | ||
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 | + initial = True | ||
13 | + | ||
14 | + dependencies = [ | ||
15 | + ('poll', '0001_initial'), | ||
16 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
17 | + ] | ||
18 | + | ||
19 | + operations = [ | ||
20 | + migrations.AddField( | ||
21 | + model_name='answersstudent', | ||
22 | + name='student', | ||
23 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers_stundent', to=settings.AUTH_USER_MODEL, verbose_name='Student'), | ||
24 | + ), | ||
25 | + migrations.AddField( | ||
26 | + model_name='answer', | ||
27 | + name='poll', | ||
28 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='poll.Poll', verbose_name='Answers'), | ||
29 | + ), | ||
30 | + ] |
users/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-17 15:49 | 2 | +# Generated by Django 1.10 on 2016-10-18 20:26 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | import django.contrib.auth.models | 5 | import django.contrib.auth.models |
@@ -42,8 +42,8 @@ class Migration(migrations.Migration): | @@ -42,8 +42,8 @@ class Migration(migrations.Migration): | ||
42 | ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), | 42 | ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), |
43 | ], | 43 | ], |
44 | options={ | 44 | options={ |
45 | - 'verbose_name_plural': 'Users', | ||
46 | 'verbose_name': 'User', | 45 | 'verbose_name': 'User', |
46 | + 'verbose_name_plural': 'Users', | ||
47 | }, | 47 | }, |
48 | managers=[ | 48 | managers=[ |
49 | ('objects', django.contrib.auth.models.UserManager()), | 49 | ('objects', django.contrib.auth.models.UserManager()), |