Commit f2811c4133269d07d8079ed6913cfe973cab7d86
1 parent
1a710e24
Exists in
master
and in
5 other branches
impoviment the exercise's model #95
Showing
32 changed files
with
493 additions
and
368 deletions
Show diff stats
app/migrations/0001_initial.py
1 | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-11-16 20:53 | |
3 | - | |
2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
4 | 3 | from __future__ import unicode_literals |
5 | 4 | |
6 | 5 | from django.db import migrations, models |
... | ... | @@ -27,8 +26,8 @@ class Migration(migrations.Migration): |
27 | 26 | ('default_from_email', models.EmailField(max_length=254, verbose_name='Default from email')), |
28 | 27 | ], |
29 | 28 | options={ |
30 | - 'verbose_name_plural': 'Amadeus SMTP settings', | |
31 | 29 | 'verbose_name': 'Amadeus SMTP setting', |
30 | + 'verbose_name_plural': 'Amadeus SMTP settings', | |
32 | 31 | }, |
33 | 32 | ), |
34 | 33 | ] | ... | ... |
core/migrations/0001_initial.py
1 | 1 | # -*- coding: utf-8 -*- |
2 | - | |
3 | -# Generated by Django 1.10 on 2016-11-16 20:53 | |
4 | - | |
2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
5 | 3 | from __future__ import unicode_literals |
6 | 4 | |
7 | 5 | import autoslug.fields |
8 | -from django.conf import settings | |
9 | 6 | import django.contrib.postgres.fields.jsonb |
10 | 7 | from django.db import migrations, models |
11 | 8 | import django.db.models.deletion |
... | ... | @@ -16,7 +13,6 @@ class Migration(migrations.Migration): |
16 | 13 | initial = True |
17 | 14 | |
18 | 15 | dependencies = [ |
19 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
20 | 16 | ] |
21 | 17 | |
22 | 18 | operations = [ |
... | ... | @@ -29,19 +25,18 @@ class Migration(migrations.Migration): |
29 | 25 | ('created_date', models.DateTimeField(auto_now_add=True, verbose_name='Created Date')), |
30 | 26 | ], |
31 | 27 | options={ |
32 | - 'verbose_name_plural': 'Actions', | |
33 | 28 | 'verbose_name': 'Action', |
29 | + 'verbose_name_plural': 'Actions', | |
34 | 30 | }, |
35 | 31 | ), |
36 | 32 | migrations.CreateModel( |
37 | 33 | name='Action_Resource', |
38 | 34 | fields=[ |
39 | 35 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
40 | - ('action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied')), | |
41 | 36 | ], |
42 | 37 | options={ |
43 | - 'verbose_name_plural': 'Action_Resources', | |
44 | 38 | 'verbose_name': 'Action_Resource', |
39 | + 'verbose_name_plural': 'Action_Resources', | |
45 | 40 | }, |
46 | 41 | ), |
47 | 42 | migrations.CreateModel( |
... | ... | @@ -51,12 +46,10 @@ class Migration(migrations.Migration): |
51 | 46 | ('component', models.TextField(verbose_name='Component (Module / App)')), |
52 | 47 | ('context', django.contrib.postgres.fields.jsonb.JSONField(blank=True, verbose_name='Context')), |
53 | 48 | ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), |
54 | - ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')), | |
55 | - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor')), | |
56 | 49 | ], |
57 | 50 | options={ |
58 | - 'verbose_name_plural': 'Logs', | |
59 | 51 | 'verbose_name': 'Log', |
52 | + 'verbose_name_plural': 'Logs', | |
60 | 53 | }, |
61 | 54 | ), |
62 | 55 | migrations.CreateModel( |
... | ... | @@ -67,8 +60,8 @@ class Migration(migrations.Migration): |
67 | 60 | ('icon', models.CharField(max_length=50, unique=True, verbose_name='Icon')), |
68 | 61 | ], |
69 | 62 | options={ |
70 | - 'verbose_name_plural': 'Amadeus Mime Types', | |
71 | 63 | 'verbose_name': 'Amadeus Mime Type', |
64 | + 'verbose_name_plural': 'Amadeus Mime Types', | |
72 | 65 | }, |
73 | 66 | ), |
74 | 67 | migrations.CreateModel( |
... | ... | @@ -79,12 +72,10 @@ class Migration(migrations.Migration): |
79 | 72 | ('read', models.BooleanField(default=False, verbose_name='Read')), |
80 | 73 | ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), |
81 | 74 | ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')), |
82 | - ('actor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notification_Performer', to=settings.AUTH_USER_MODEL, verbose_name='Performer')), | |
83 | - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User')), | |
84 | 75 | ], |
85 | 76 | options={ |
86 | - 'verbose_name_plural': 'Notifications', | |
87 | 77 | 'verbose_name': 'Notification', |
78 | + 'verbose_name_plural': 'Notifications', | |
88 | 79 | }, |
89 | 80 | ), |
90 | 81 | migrations.CreateModel( |
... | ... | @@ -97,13 +88,8 @@ class Migration(migrations.Migration): |
97 | 88 | ('url', models.CharField(default='', max_length=100, verbose_name='URL')), |
98 | 89 | ], |
99 | 90 | options={ |
100 | - 'verbose_name_plural': 'Resources', | |
101 | 91 | 'verbose_name': 'Resource', |
92 | + 'verbose_name_plural': 'Resources', | |
102 | 93 | }, |
103 | 94 | ), |
104 | - migrations.AddField( | |
105 | - model_name='action_resource', | |
106 | - name='resource', | |
107 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Resource', verbose_name='Resource'), | |
108 | - ), | |
109 | 95 | ] | ... | ... |
... | ... | @@ -0,0 +1,50 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
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 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
16 | + ('core', '0001_initial'), | |
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='Performer'), | |
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 | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-11-16 20:52 | |
3 | - | |
2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
4 | 3 | from __future__ import unicode_literals |
5 | 4 | |
6 | 5 | import autoslug.fields |
7 | -from django.conf import settings | |
8 | 6 | from django.db import migrations, models |
9 | 7 | import django.db.models.deletion |
10 | 8 | import s3direct.fields |
... | ... | @@ -15,8 +13,7 @@ class Migration(migrations.Migration): |
15 | 13 | initial = True |
16 | 14 | |
17 | 15 | dependencies = [ |
18 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
19 | - ('core', '__first__'), | |
16 | + ('core', '0001_initial'), | |
20 | 17 | ] |
21 | 18 | |
22 | 19 | operations = [ |
... | ... | @@ -26,7 +23,6 @@ class Migration(migrations.Migration): |
26 | 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')), |
27 | 24 | ('limit_date', models.DateField(verbose_name='Deliver Date')), |
28 | 25 | ('all_students', models.BooleanField(default=False, verbose_name='All Students')), |
29 | - ('students', models.ManyToManyField(related_name='activities', to=settings.AUTH_USER_MODEL, verbose_name='Students')), | |
30 | 26 | ], |
31 | 27 | bases=('core.resource',), |
32 | 28 | ), |
... | ... | @@ -36,11 +32,10 @@ class Migration(migrations.Migration): |
36 | 32 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
37 | 33 | ('pdf', s3direct.fields.S3DirectField()), |
38 | 34 | ('name', models.CharField(max_length=100)), |
39 | - ('diet', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='courses.Activity')), | |
40 | 35 | ], |
41 | 36 | options={ |
42 | - 'verbose_name_plural': 'Activitys Files', | |
43 | 37 | 'verbose_name': 'Activity File', |
38 | + 'verbose_name_plural': 'Activitys Files', | |
44 | 39 | }, |
45 | 40 | ), |
46 | 41 | migrations.CreateModel( |
... | ... | @@ -52,8 +47,8 @@ class Migration(migrations.Migration): |
52 | 47 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), |
53 | 48 | ], |
54 | 49 | options={ |
55 | - 'verbose_name_plural': 'Categories', | |
56 | 50 | 'verbose_name': 'Category', |
51 | + 'verbose_name_plural': 'Categories', | |
57 | 52 | }, |
58 | 53 | ), |
59 | 54 | migrations.CreateModel( |
... | ... | @@ -66,9 +61,9 @@ class Migration(migrations.Migration): |
66 | 61 | ('public', models.BooleanField(default=False, verbose_name='Public')), |
67 | 62 | ], |
68 | 63 | options={ |
64 | + 'verbose_name': 'Course', | |
69 | 65 | 'ordering': ('name',), |
70 | 66 | 'verbose_name_plural': 'Courses', |
71 | - 'verbose_name': 'Course', | |
72 | 67 | }, |
73 | 68 | ), |
74 | 69 | migrations.CreateModel( |
... | ... | @@ -80,8 +75,8 @@ class Migration(migrations.Migration): |
80 | 75 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), |
81 | 76 | ], |
82 | 77 | options={ |
83 | - 'verbose_name_plural': 'Categories', | |
84 | 78 | 'verbose_name': 'Category', |
79 | + 'verbose_name_plural': 'Categories', | |
85 | 80 | }, |
86 | 81 | ), |
87 | 82 | migrations.CreateModel( |
... | ... | @@ -106,7 +101,6 @@ class Migration(migrations.Migration): |
106 | 101 | fields=[ |
107 | 102 | ('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')), |
108 | 103 | ('all_students', models.BooleanField(default=False, verbose_name='All Students')), |
109 | - ('students', models.ManyToManyField(related_name='materials', to=settings.AUTH_USER_MODEL, verbose_name='Students')), | |
110 | 104 | ], |
111 | 105 | bases=('core.resource',), |
112 | 106 | ), |
... | ... | @@ -124,13 +118,11 @@ class Migration(migrations.Migration): |
124 | 118 | ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), |
125 | 119 | ('category', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='subject_category', to='courses.CategorySubject', verbose_name='Category')), |
126 | 120 | ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course')), |
127 | - ('professors', models.ManyToManyField(related_name='professors_subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors')), | |
128 | - ('students', models.ManyToManyField(blank=True, related_name='subject_student', to=settings.AUTH_USER_MODEL, verbose_name='Students')), | |
129 | 121 | ], |
130 | 122 | options={ |
123 | + 'verbose_name': 'Subject', | |
131 | 124 | 'ordering': ('create_date', 'name'), |
132 | 125 | 'verbose_name_plural': 'Subjects', |
133 | - 'verbose_name': 'Subject', | |
134 | 126 | }, |
135 | 127 | ), |
136 | 128 | migrations.CreateModel( |
... | ... | @@ -143,8 +135,8 @@ class Migration(migrations.Migration): |
143 | 135 | ('subjects', models.ManyToManyField(to='courses.Subject')), |
144 | 136 | ], |
145 | 137 | options={ |
146 | - 'verbose_name_plural': 'subject categories', | |
147 | 138 | 'verbose_name': 'subject category', |
139 | + 'verbose_name_plural': 'subject categories', | |
148 | 140 | }, |
149 | 141 | ), |
150 | 142 | migrations.CreateModel( |
... | ... | @@ -160,39 +152,9 @@ class Migration(migrations.Migration): |
160 | 152 | ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject')), |
161 | 153 | ], |
162 | 154 | options={ |
155 | + 'verbose_name': 'Topic', | |
163 | 156 | 'ordering': ('create_date', 'name'), |
164 | 157 | 'verbose_name_plural': 'Topics', |
165 | - 'verbose_name': 'Topic', | |
166 | 158 | }, |
167 | 159 | ), |
168 | - migrations.AddField( | |
169 | - model_name='material', | |
170 | - name='topic', | |
171 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'), | |
172 | - ), | |
173 | - migrations.AddField( | |
174 | - model_name='linkmaterial', | |
175 | - name='material', | |
176 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_link', to='courses.Material', verbose_name='Material'), | |
177 | - ), | |
178 | - migrations.AddField( | |
179 | - model_name='filematerial', | |
180 | - name='material', | |
181 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_file', to='courses.Material', verbose_name='Material'), | |
182 | - ), | |
183 | - migrations.AddField( | |
184 | - model_name='course', | |
185 | - name='category', | |
186 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_category', to='courses.CourseCategory', verbose_name='Category'), | |
187 | - ), | |
188 | - migrations.AddField( | |
189 | - model_name='course', | |
190 | - name='coordenator', | |
191 | - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='course_coordenator', to=settings.AUTH_USER_MODEL, verbose_name='Coordenator'), | |
192 | - ), | |
193 | - migrations.AddField( | |
194 | - model_name='activity', | |
195 | - name='topic', | |
196 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'), | |
197 | - ), | |
198 | 160 | ] | ... | ... |
... | ... | @@ -0,0 +1,75 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
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 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
16 | + ('courses', '0001_initial'), | |
17 | + ] | |
18 | + | |
19 | + operations = [ | |
20 | + migrations.AddField( | |
21 | + model_name='subject', | |
22 | + name='professors', | |
23 | + field=models.ManyToManyField(related_name='professors_subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | |
24 | + ), | |
25 | + migrations.AddField( | |
26 | + model_name='subject', | |
27 | + name='students', | |
28 | + field=models.ManyToManyField(blank=True, related_name='subject_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
29 | + ), | |
30 | + migrations.AddField( | |
31 | + model_name='material', | |
32 | + name='students', | |
33 | + field=models.ManyToManyField(related_name='materials', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
34 | + ), | |
35 | + migrations.AddField( | |
36 | + model_name='material', | |
37 | + name='topic', | |
38 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'), | |
39 | + ), | |
40 | + migrations.AddField( | |
41 | + model_name='linkmaterial', | |
42 | + name='material', | |
43 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_link', to='courses.Material', verbose_name='Material'), | |
44 | + ), | |
45 | + migrations.AddField( | |
46 | + model_name='filematerial', | |
47 | + name='material', | |
48 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_file', to='courses.Material', verbose_name='Material'), | |
49 | + ), | |
50 | + migrations.AddField( | |
51 | + model_name='course', | |
52 | + name='category', | |
53 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_category', to='courses.CourseCategory', verbose_name='Category'), | |
54 | + ), | |
55 | + migrations.AddField( | |
56 | + model_name='course', | |
57 | + name='coordenator', | |
58 | + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='course_coordenator', to=settings.AUTH_USER_MODEL, verbose_name='Coordenator'), | |
59 | + ), | |
60 | + migrations.AddField( | |
61 | + model_name='activityfile', | |
62 | + name='diet', | |
63 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='courses.Activity'), | |
64 | + ), | |
65 | + migrations.AddField( | |
66 | + model_name='activity', | |
67 | + name='students', | |
68 | + field=models.ManyToManyField(related_name='activities', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
69 | + ), | |
70 | + migrations.AddField( | |
71 | + model_name='activity', | |
72 | + name='topic', | |
73 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'), | |
74 | + ), | |
75 | + ] | ... | ... |
courses/templates/subject/form_view_teacher.html
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | <button class="btn btn-default btn-sm caret-square"><i class="fa fa-caret-square-o-down fa-2x" aria-hidden="true"></i></button> |
8 | 8 | </div> |
9 | 9 | <div class="col-xs-9 col-md-9 titleTopic"> |
10 | - <a role="button"> | |
10 | + <a href="{% url 'course:view_topic' topic.slug %}" role="button"> | |
11 | 11 | <h4>{{topic}}</h4> |
12 | 12 | </a> |
13 | 13 | </div><!--column --> |
... | ... | @@ -123,12 +123,6 @@ |
123 | 123 | </ul> |
124 | 124 | </div> |
125 | 125 | </div> |
126 | - <div class="col-xs-4 col-md-4"> | |
127 | - <div class="resource_inline"> | |
128 | - <a href="{% url 'exercise:home' topic.slug %}"><h4>{% trans 'Exercises' %}</h4></a> | |
129 | - </div> | |
130 | - </div> | |
131 | - {% include "exercise/create_exercise.html" %} | |
132 | 126 | </div> |
133 | 127 | |
134 | 128 | {# opções de cancelar e editar no modo de edição #} | ... | ... |
courses/templates/topic/index.html
... | ... | @@ -65,7 +65,7 @@ |
65 | 65 | </div> |
66 | 66 | <div class="panel panel-default"> |
67 | 67 | <div class="panel-body"> |
68 | - {% include "topic/topic_card_student.html" %} | |
68 | + {% include "topic/topic_card.html" %} | |
69 | 69 | {% comment %} |
70 | 70 | |
71 | 71 | |
... | ... | @@ -116,13 +116,19 @@ |
116 | 116 | </fieldset> |
117 | 117 | </form>--> |
118 | 118 | {% endcomment %} |
119 | - | |
120 | - | |
121 | - | |
122 | - | |
123 | 119 | </div> |
124 | - | |
125 | - | |
126 | 120 | </div> |
127 | 121 | </div> |
122 | + <h3>{% trans 'Exercises' %}</h3> | |
123 | + {# mostra a lista de usuários caso seja um professor ou admin #} | |
124 | + {% if user|has_role:'professor' or user|has_role:'system_admin' %} | |
125 | + {% for user in users %} | |
126 | + {% include "exercise/card_list_user.html" %} | |
127 | + {% endfor %} | |
128 | + {# caso seja um estudante, mostra a lista de exercícios proposta a ele #} | |
129 | + {% elif user|has_role:'student'%} | |
130 | + {% for exercise in exercises %} | |
131 | + {% include "exercise/card_topic_exercises.html" %} | |
132 | + {% endfor %} | |
133 | + {% endif %} | |
128 | 134 | {% endblock %} | ... | ... |
... | ... | @@ -0,0 +1,28 @@ |
1 | +{% load static i18n list_topic_foruns permission_tags widget_tweaks professor_access%} | |
2 | + | |
3 | + | |
4 | +<div class="row"> | |
5 | + <div class="col-xs-6 col-md-6"> | |
6 | + <div class="resource_inline"> | |
7 | + <h4>{% trans "Materials" %}</h4> | |
8 | + </div> | |
9 | + | |
10 | + <ul id="list-materials"> | |
11 | + {% list_topic_file request topic %} | |
12 | + {% list_topic_link request topic%} | |
13 | + | |
14 | + </ul> | |
15 | + </div> | |
16 | + <div class="col-xs-6 col-md-6"> | |
17 | + <div class="resource_inline"> | |
18 | + <h4>{% trans "Activities" %}</h4> | |
19 | + </div> | |
20 | + <ul> | |
21 | + <div class="foruns_list"> | |
22 | + {# {% list_topic_exam request topic %} #} | |
23 | + {% list_topic_poll request topic %} | |
24 | + {% list_topic_foruns request topic %} | |
25 | + </div> | |
26 | + </ul> | |
27 | + </div> | |
28 | +</div> | |
0 | 29 | \ No newline at end of file | ... | ... |
courses/templates/topic/topic_card_student.html
... | ... | @@ -1,29 +0,0 @@ |
1 | -{% load static i18n list_topic_foruns permission_tags widget_tweaks professor_access%} | |
2 | - | |
3 | - | |
4 | -<div class="row"> | |
5 | - <div class="col-xs-6 col-md-6"> | |
6 | - <div class="resource_inline"> | |
7 | - <h4>{% trans "Materials" %}</h4> | |
8 | - </div> | |
9 | - | |
10 | - <ul id="list-materials"> | |
11 | - {% list_topic_file request topic %} | |
12 | - {% list_topic_link request topic%} | |
13 | - | |
14 | - </ul> | |
15 | - </div> | |
16 | - <div class="col-xs-4 col-md-4"> | |
17 | - <div class="resource_inline"> | |
18 | - <h4>{% trans "Activities" %}</h4> | |
19 | - </div> | |
20 | - <ul> | |
21 | - <div class="foruns_list"> | |
22 | - {% list_topic_exam request topic %} | |
23 | - {% list_topic_poll request topic %} | |
24 | - {% list_topic_foruns request topic %} | |
25 | - </div> | |
26 | - </ul> | |
27 | - </div> | |
28 | - | |
29 | -</div> |
courses/views.py
... | ... | @@ -622,6 +622,12 @@ class TopicsView(LoginRequiredMixin, LogMixin, generic.ListView): |
622 | 622 | activitys = Activity.objects.filter(topic__name = topic.name) |
623 | 623 | students_activit = User.objects.filter(activities__in = Activity.objects.all()) |
624 | 624 | materials = Material.objects.filter(topic = topic) |
625 | + if has_role(self.request.user, 'professor'): | |
626 | + users = User.objects.all() | |
627 | + context['users'] = users | |
628 | + elif has_role(self.request.user, 'student'): | |
629 | + exercises = Exercise.objects.all().filter(students=self.request.user) | |
630 | + context['exercises'] = exercises | |
625 | 631 | |
626 | 632 | context['topic'] = topic |
627 | 633 | context['subject'] = topic.subject | ... | ... |
exam/migrations/0001_initial.py
1 | 1 | # -*- coding: utf-8 -*- |
2 | - | |
3 | -# Generated by Django 1.10 on 2016-11-16 20:53 | |
4 | - | |
2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
5 | 3 | from __future__ import unicode_literals |
6 | 4 | |
7 | -from django.conf import settings | |
8 | 5 | from django.db import migrations, models |
9 | 6 | import django.db.models.deletion |
10 | 7 | |
... | ... | @@ -15,7 +12,6 @@ class Migration(migrations.Migration): |
15 | 12 | |
16 | 13 | dependencies = [ |
17 | 14 | ('courses', '0001_initial'), |
18 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
19 | 15 | ] |
20 | 16 | |
21 | 17 | operations = [ |
... | ... | @@ -27,8 +23,8 @@ class Migration(migrations.Migration): |
27 | 23 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), |
28 | 24 | ], |
29 | 25 | options={ |
30 | - 'ordering': ('order',), | |
31 | 26 | 'verbose_name': 'Answer', |
27 | + 'ordering': ('order',), | |
32 | 28 | 'verbose_name_plural': 'Answers', |
33 | 29 | }, |
34 | 30 | ), |
... | ... | @@ -41,8 +37,8 @@ class Migration(migrations.Migration): |
41 | 37 | ('answer', models.ManyToManyField(related_name='student_answer', to='exam.Answer', verbose_name='Answers Students')), |
42 | 38 | ], |
43 | 39 | options={ |
44 | - 'verbose_name_plural': 'Answers Student', | |
45 | 40 | 'verbose_name': 'Answer Stundent', |
41 | + 'verbose_name_plural': 'Answers Student', | |
46 | 42 | }, |
47 | 43 | ), |
48 | 44 | migrations.CreateModel( |
... | ... | @@ -53,8 +49,8 @@ class Migration(migrations.Migration): |
53 | 49 | ('exibe', models.BooleanField(default=False, verbose_name='Exibe?')), |
54 | 50 | ], |
55 | 51 | options={ |
56 | - 'verbose_name_plural': 'Exams', | |
57 | 52 | 'verbose_name': 'Exam', |
53 | + 'verbose_name_plural': 'Exams', | |
58 | 54 | }, |
59 | 55 | bases=('courses.activity',), |
60 | 56 | ), |
... | ... | @@ -63,14 +59,4 @@ class Migration(migrations.Migration): |
63 | 59 | name='exam', |
64 | 60 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student_exam', to='exam.Exam', verbose_name='Exam'), |
65 | 61 | ), |
66 | - migrations.AddField( | |
67 | - model_name='answersstudent', | |
68 | - name='student', | |
69 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student', to=settings.AUTH_USER_MODEL, verbose_name='Student'), | |
70 | - ), | |
71 | - migrations.AddField( | |
72 | - model_name='answer', | |
73 | - name='exam', | |
74 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='exam.Exam', verbose_name='Answers'), | |
75 | - ), | |
76 | 62 | ] | ... | ... |
... | ... | @@ -0,0 +1,30 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
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 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
16 | + ('exam', '0001_initial'), | |
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='student', to=settings.AUTH_USER_MODEL, verbose_name='Student'), | |
24 | + ), | |
25 | + migrations.AddField( | |
26 | + model_name='answer', | |
27 | + name='exam', | |
28 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='exam.Exam', verbose_name='Answers'), | |
29 | + ), | |
30 | + ] | ... | ... |
exercise/admin.py
1 | 1 | from django.contrib import admin |
2 | -from .models import Exercise | |
2 | +from .models import Exercise, File | |
3 | 3 | |
4 | 4 | class ExerciseAdmin(admin.ModelAdmin): |
5 | 5 | list_display = ['name'] |
6 | 6 | search_fields = ['name'] |
7 | 7 | |
8 | +class FileAdmin(admin.ModelAdmin): | |
9 | + list_display = ['name'] | |
10 | + search_fields = ['name'] | |
11 | + | |
8 | 12 | admin.site.register(Exercise, ExerciseAdmin) |
13 | +admin.site.register(File, ExerciseAdmin) | ... | ... |
exercise/forms.py
... | ... | @@ -9,11 +9,11 @@ class ExerciseForm(forms.ModelForm): |
9 | 9 | |
10 | 10 | class Meta: |
11 | 11 | model = Exercise |
12 | - fields = ['name', 'file'] | |
12 | + fields = ['name'] | |
13 | 13 | |
14 | 14 | |
15 | 15 | class UpdateExerciseForm(forms.ModelForm): |
16 | 16 | |
17 | 17 | class Meta: |
18 | 18 | model = Exercise |
19 | - fields = ['name', 'file'] | |
19 | + fields = ['name'] | ... | ... |
exercise/migrations/0001_initial.py
1 | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-11-16 20:53 | |
3 | - | |
2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
4 | 3 | from __future__ import unicode_literals |
5 | 4 | |
5 | +from decimal import Decimal | |
6 | 6 | from django.db import migrations, models |
7 | 7 | import django.db.models.deletion |
8 | 8 | |
... | ... | @@ -12,7 +12,6 @@ class Migration(migrations.Migration): |
12 | 12 | initial = True |
13 | 13 | |
14 | 14 | dependencies = [ |
15 | - ('courses', '0001_initial'), | |
16 | 15 | ] |
17 | 16 | |
18 | 17 | operations = [ |
... | ... | @@ -20,9 +19,20 @@ class Migration(migrations.Migration): |
20 | 19 | name='Exercise', |
21 | 20 | fields=[ |
22 | 21 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
23 | - ('file', models.FileField(upload_to='uploads/%Y/%m/%d')), | |
22 | + ('description', models.TextField(blank=True, verbose_name='Descrição')), | |
23 | + ('init_date', models.DateField(verbose_name='Begin of Subject Date')), | |
24 | + ('end_date', models.DateField(verbose_name='End of Subject Date')), | |
25 | + ('grade', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=20, null=True)), | |
24 | 26 | ('name', models.CharField(max_length=100)), |
25 | - ('topic', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='exercises', to='courses.Topic', verbose_name='Topic')), | |
27 | + ], | |
28 | + ), | |
29 | + migrations.CreateModel( | |
30 | + name='File', | |
31 | + fields=[ | |
32 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |
33 | + ('name', models.CharField(max_length=100)), | |
34 | + ('file', models.FileField(upload_to='uploads/%Y/%m/%d')), | |
35 | + ('exercise', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='file', to='exercise.Exercise')), | |
26 | 36 | ], |
27 | 37 | ), |
28 | 38 | ] | ... | ... |
exercise/migrations/0002_auto_20161116_2111.py
... | ... | @@ -1,27 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-11-17 00:11 | |
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 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
13 | - ('exercise', '0001_initial'), | |
14 | - ] | |
15 | - | |
16 | - operations = [ | |
17 | - migrations.AddField( | |
18 | - model_name='exercise', | |
19 | - name='professors', | |
20 | - field=models.ManyToManyField(related_name='professors_exercise', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | |
21 | - ), | |
22 | - migrations.AddField( | |
23 | - model_name='exercise', | |
24 | - name='students', | |
25 | - field=models.ManyToManyField(blank=True, related_name='subject_exercise', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
26 | - ), | |
27 | - ] |
... | ... | @@ -0,0 +1,36 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
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 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
16 | + ('exercise', '0001_initial'), | |
17 | + ('courses', '0002_auto_20161117_0009'), | |
18 | + ] | |
19 | + | |
20 | + operations = [ | |
21 | + migrations.AddField( | |
22 | + model_name='exercise', | |
23 | + name='professors', | |
24 | + field=models.ManyToManyField(blank=True, related_name='professors_exercise', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | |
25 | + ), | |
26 | + migrations.AddField( | |
27 | + model_name='exercise', | |
28 | + name='students', | |
29 | + field=models.ManyToManyField(blank=True, related_name='subject_exercise', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
30 | + ), | |
31 | + migrations.AddField( | |
32 | + model_name='exercise', | |
33 | + name='topic', | |
34 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='exercises', to='courses.Topic', verbose_name='Topic'), | |
35 | + ), | |
36 | + ] | ... | ... |
exercise/models.py
1 | -from django.db import models | |
2 | 1 | from courses.models import Topic |
2 | +from decimal import Decimal | |
3 | +from django.db import models | |
3 | 4 | from django.utils.translation import ugettext_lazy as _ |
4 | 5 | from users.models import User |
5 | 6 | |
... | ... | @@ -16,10 +17,24 @@ def file_path(instance, filename): |
16 | 17 | It represents the Exercises inside topic. |
17 | 18 | """ |
18 | 19 | |
19 | - | |
20 | 20 | class Exercise(models.Model): |
21 | 21 | topic = models.ForeignKey(Topic, verbose_name=_('Topic'), related_name='exercises') |
22 | - professors = models.ManyToManyField(User, verbose_name=_('Professors'), related_name='professors_exercise') | |
22 | + professors = models.ManyToManyField(User, verbose_name=_('Professors'), related_name='professors_exercise', blank=True) | |
23 | 23 | students = models.ManyToManyField(User, verbose_name=_('Students'), related_name='subject_exercise', blank = True) |
24 | - file = models.FileField(upload_to='uploads/%Y/%m/%d') | |
24 | + description = models.TextField(_('Descrição'), blank=True) | |
25 | + init_date = models.DateField(_('Begin of Subject Date')) | |
26 | + end_date = models.DateField(_('End of Subject Date')) | |
27 | + grade = models.DecimalField(max_digits=20, decimal_places=2, default=Decimal('0.00'), null=True) | |
28 | + name = models.CharField(max_length=100) | |
29 | + | |
30 | + def __str__(self): | |
31 | + return self.name | |
32 | + | |
33 | + | |
34 | +class File(models.Model): | |
25 | 35 | name = models.CharField(max_length=100) |
36 | + file = models.FileField(upload_to='uploads/%Y/%m/%d') | |
37 | + exercise = models.ForeignKey(Exercise, related_name='file') | |
38 | + | |
39 | + def __str__(self): | |
40 | + return self.name | |
26 | 41 | \ No newline at end of file | ... | ... |
exercise/templates/exercise/card_list_user.html
1 | 1 | {% load static i18n list_topic_foruns permission_tags widget_tweaks professor_access list_topic_exercises %} |
2 | 2 | |
3 | -{% block javascript %} | |
4 | -<script type="text/javascript" src="{% static 'js/forum.js' %}"></script> | |
5 | -<script src="{% static 'js/file.js' %}"></script> | |
6 | -<script type="text/javascript" src="{% static 'js/material.js' %}"></script> | |
7 | -<script type = "text/javascript" src="{% static 'links.js' %}"></script> | |
8 | -{% endblock %} | |
9 | -<div class="cards-detail"> | |
10 | - <div class="panel-group accordion ui-accordion ui-widget ui-helper-reset ui-sortable" role="tablist" aria-multiselectable="false"> | |
11 | - <div class="group"><div class="panel panel-default"> | |
12 | - <div class="panel-heading topic ui-sortable-handle" role="tab"> | |
13 | - <div class="row"> | |
14 | - <div class="col-md-1 moreAccordion" data-toggle="collapse" data-parent="#accordion-{{user.id}}" href=".collapseTopic-{{user.id}}" aria-expanded="false" aria-controls="collapseTopic-{{user.id}}"> | |
15 | - <button class="btn btn-default btn-sm caret-square"><i class="fa fa-caret-square-o-down fa-2x" aria-hidden="true"></i></button> | |
16 | - </div> | |
17 | - <div class="col-xs-9 col-md-9 titleTopic"> | |
18 | - <a href="" role="button"> | |
19 | - <h4>{{user|capfirst}}</h4> | |
20 | - </a> | |
3 | + <div class="col-md-12 col-sm-12 col-lg-12"> | |
4 | + <div class="panel-group accordion ui-accordion ui-widget ui-helper-reset ui-sortable" role="tablist" aria-multiselectable="false"> | |
5 | + <div class="group"><div class="panel panel-default"> | |
6 | + <div class="panel-heading topic ui-sortable-handle" role="tab"> | |
7 | + <div class="row"> | |
8 | + <div class="col-md-1 moreAccordion" data-toggle="collapse" data-parent="#accordion-{{user.id}}" href=".collapseTopic-{{user.id}}" aria-expanded="false" aria-controls="collapseTopic-{{user.id}}"> | |
9 | + <button class="btn btn-default btn-sm caret-square"><i class="fa fa-caret-square-o-down fa-2x" aria-hidden="true"></i></button> | |
10 | + </div> | |
11 | + <div class="col-xs-9 col-md-9 titleTopic"> | |
12 | + <a href="" role="button"> | |
13 | + <h4>{{user|capfirst}}</h4> | |
14 | + </a> | |
15 | + </div> | |
21 | 16 | </div> |
22 | 17 | </div> |
23 | - </div> | |
24 | - <div class="panel-collapse collapseTopic-{{user.id}} collapse in" role="tabpanel" aria-labelledby="heading_{{user.id}}" aria-expanded="true" aria-hidden="false"> | |
25 | - <div class="panel-body"> | |
26 | - <div class="presentation"> | |
27 | - <p> | |
28 | - <i> | |
29 | - | |
30 | - </i> | |
31 | - </p> | |
18 | + <div class="panel-collapse collapseTopic-{{user.id}} collapse in" role="tabpanel" aria-labelledby="heading_{{user.id}}" aria-expanded="true" aria-hidden="false"> | |
19 | + <div class="panel-body"> | |
20 | + <div class="presentation"> | |
21 | + <p> | |
22 | + <i> | |
23 | + | |
24 | + </i> | |
25 | + </p> | |
32 | 26 | |
27 | + </div> | |
33 | 28 | </div> |
34 | 29 | </div> |
35 | 30 | </div> |
36 | - | |
37 | 31 | </div> |
38 | - | |
39 | 32 | </div> |
40 | - | |
41 | -</div> | |
42 | 33 | </div> |
43 | 34 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,62 @@ |
1 | +{% load static widget_tweaks i18n %} | |
2 | + | |
3 | +<div class="col-lg-4 col-xs-4 col-sm-4"> | |
4 | + <div class="panel panel-default"> | |
5 | + <div class="panel-body"> | |
6 | + <form class="form-horizontal"> | |
7 | + <fieldset> | |
8 | + <center><legend>{{exercise.name}}</legend></center> | |
9 | + <div class="container-fluid"> | |
10 | + <div class="form-group"> | |
11 | + <label class="col-md-2 col-xs-2 col-sm-2 control-label">Describe: </label><br> | |
12 | + {% if exercise.description%} | |
13 | + {{exercise.description}} | |
14 | + {% else %} | |
15 | + {% trans "Don't have description" %} | |
16 | + {% endif %} | |
17 | + </div> | |
18 | + <div class="form-group"> | |
19 | + <label class="col-md-2 col-xs-2 col-sm-2 control-label">Opening: </label><br>{{exercise.init_date}} | |
20 | + | |
21 | + </div> | |
22 | + <div class="form-group"> | |
23 | + <label class="col-md-2 col-xs-2 col-sm-2 control-label">Ending: </label><br>{{exercise.end_date}} | |
24 | + | |
25 | + </div> | |
26 | + <div class="form-group"> | |
27 | + <label for="nota" class="col-md-2 control-label">NOTA: | |
28 | + {% if exercise.grade %} | |
29 | + <div class="col-md-4"> | |
30 | + <p id="nota" class="form-control"> | |
31 | + {{exercise.grade}} | |
32 | + </p> | |
33 | + </div> | |
34 | + {% else %} | |
35 | + {% trans 'Not yet' %} | |
36 | + {% endif %} | |
37 | + </label> | |
38 | + </div> | |
39 | + {% if exercise.file %} | |
40 | + <div class="form-group"> | |
41 | + <label for="DelExc" class="col-md-4 control-label"> <i class="fa fa-file-archive-o fa-3x" aria-hidden="true"> | |
42 | + {% for file in exercise.file %} | |
43 | + <a href="{{exercise.file.url}}">{% trans 'File' %}</a> | |
44 | + {% endfor %} | |
45 | + </i> | |
46 | + </div> | |
47 | + {% else %} | |
48 | + <p>{% trans 'Exercise not yet' %}</p> | |
49 | + {% endif %} | |
50 | + {% if not exercise.grade %} | |
51 | + <div class="form-group"> | |
52 | + <label class="col-md-6 control-label"><i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>{% trans 'Teacher waiting corretion' %} | |
53 | + </div> | |
54 | + {% endif %} | |
55 | + </div> | |
56 | + | |
57 | + </fieldset> | |
58 | + </form> | |
59 | + | |
60 | + </div> | |
61 | + </div> | |
62 | +</div> | |
0 | 63 | \ No newline at end of file | ... | ... |
exercise/templates/exercise/home.html
... | ... | @@ -1,76 +0,0 @@ |
1 | -{% extends 'home.html' %} | |
2 | - | |
3 | -{% load static i18n permission_tags professor_access %} | |
4 | - | |
5 | -{% block javascript %} | |
6 | -<script type="text/javascript" src="{% static 'js/forum.js' %}"></script> | |
7 | -<script src="{% static 'js/file.js' %}"></script> | |
8 | -<script type="text/javascript" src="{% static 'js/material.js' %}"></script> | |
9 | -<script type="text/javascript" src="{% static 'js/modals_requisitions.js' %}"></script> | |
10 | -<script type = "text/javascript" src="{% static 'js/topic_editation_presentation.js' %}"></script> | |
11 | -<script type = "text/javascript" src="{% static 'js/links.js' %}"></script> | |
12 | -<script src="{% static 'js/modal_poll.js' %}"></script> | |
13 | -{% endblock %} | |
14 | - | |
15 | -{% block breadcrumbs %} | |
16 | -<ol class="breadcrumb"> | |
17 | - <li><a href="">{% trans 'Home' %}</a></li> | |
18 | - <li><a href="">{% trans 'Courses' %}</a></li> | |
19 | - <li><a href="">{{ course }}</a></li> | |
20 | - <li class="active">{{ subject }}</li> | |
21 | -</ol> | |
22 | -{% endblock %} | |
23 | - | |
24 | -{% block content %} | |
25 | -<div class="panel panel-info"> | |
26 | - <div class="panel-heading course-detail"> | |
27 | - <div class="row"> | |
28 | - <div class="col-md-10 col-sm-10"> | |
29 | - <h4>{{subject}}</h4> | |
30 | - </div> | |
31 | - | |
32 | - {# dropdown de subject com as opções de replicar, editar e deletar #} | |
33 | - <div class="col-xs-4 col-md-2 divMoreActions"> | |
34 | - | |
35 | - <div class="btn-group"> | |
36 | - <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="moreActions" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | |
37 | - <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> | |
38 | - </button> | |
39 | - <ul class="dropdown-menu pull-right" aria-labelledby="moreActions"> | |
40 | - <li><a href=""><i class="fa fa-files-o fa-fw" aria-hidden="true"></i> {% trans "Replicate" %}</a></li> | |
41 | - <li><a href=""> <i class="fa fa-pencil fa-fw" aria-hidden="true"></i> {% trans "Edit" %}</a></li> | |
42 | - <li><a href="" ><i class="fa fa-trash fa-fw" aria-hidden="true"></i> {% trans "Remove" %}</a></li> | |
43 | - </ul> | |
44 | - </div> | |
45 | - | |
46 | - </div> | |
47 | - | |
48 | - </div> | |
49 | - </div> | |
50 | - | |
51 | - {# informações do subject(professor, descrição etc) #} | |
52 | - <div class="panel-body"> | |
53 | - <p><b>{% trans "Professor" %}:</b> {% for professor in subject.professors.all %}{% if not forloop.first %},{% endif %} | |
54 | - {{professor}}{% if forloop.last %}.{% endif %}{% endfor %}</p> | |
55 | - <p> | |
56 | - <b>{% trans "Description" %}:</b> | |
57 | - {{subject.description|safe}} | |
58 | - </p> | |
59 | - <div class="row"> | |
60 | - <div class="col-xs-6 col-md-6"> | |
61 | - <p><b>{% trans "Beginning" %}:</b> {{subject.init_date}}</p> | |
62 | - </div> | |
63 | - <div class="col-xs-6 col-md-6"> | |
64 | - <p><b>{% trans "End" %}:</b> {{subject.end_date}}</p> | |
65 | - </div> | |
66 | - </div> | |
67 | - </div> | |
68 | - | |
69 | - </div> | |
70 | - | |
71 | - {# lista de usuários #} | |
72 | - {% for user in users %} | |
73 | - {% include "exercise/card_list_user.html" %} | |
74 | - {% endfor %} | |
75 | - | |
76 | - {% endblock %} |
exercise/urls.py
... | ... | @@ -2,7 +2,6 @@ from django.conf.urls import url |
2 | 2 | from . import views |
3 | 3 | |
4 | 4 | urlpatterns = [ |
5 | - url(r'^home/(?P<slug>[\w_-]+)/$', views.HomeExercise.as_view(), name='home'), | |
6 | 5 | url(r'^create_exercise/(?P<slug>[\w_-]+)/$', views.CreateExercise.as_view(), name='create_exercise'), |
7 | 6 | url(r'^delete_exercise/(?P<slug>[\w_-]+)/$', views.DeleteExercise.as_view(), name='delete_exercise'), |
8 | 7 | url(r'^update_exercise/(?P<slug>[\w_-]+)/$', views.UpdateExercise.as_view(), name='update_exercise'), | ... | ... |
exercise/views.py
... | ... | @@ -18,27 +18,6 @@ from rolepermissions.verifications import has_role |
18 | 18 | from users.models import User |
19 | 19 | |
20 | 20 | |
21 | -class HomeExercise(LoginRequiredMixin, HasRoleMixin, LogMixin, NotificationMixin, generic.ListView): | |
22 | - | |
23 | - allowed_roles = ['student', 'professor'] | |
24 | - login_url = reverse_lazy("core:home") | |
25 | - redirect_field_name = 'next' | |
26 | - queryset = User.objects.all() | |
27 | - template_name = 'exercise/home.html' | |
28 | - context_object_name = 'users' | |
29 | - paginate_by = 10 | |
30 | - | |
31 | - def get_context_data(self, **kwargs): | |
32 | - context = super(HomeExercise, self).get_context_data(**kwargs) | |
33 | - topic = get_object_or_404(Topic, slug=self.kwargs.get('slug')) | |
34 | - # users = self.queryset.filter(subject_student = ) | |
35 | - context['topic'] = topic | |
36 | - # context['users'] = users | |
37 | - context['subject'] = topic.subject | |
38 | - | |
39 | - return context | |
40 | - | |
41 | - | |
42 | 21 | class CreateExercise(LoginRequiredMixin, HasRoleMixin, LogMixin, NotificationMixin, generic.CreateView): |
43 | 22 | log_component = 'exercise' |
44 | 23 | log_resource = 'exercise' | ... | ... |
files/migrations/0001_initial.py
1 | 1 | # -*- coding: utf-8 -*- |
2 | - | |
3 | -# Generated by Django 1.10 on 2016-11-16 20:54 | |
4 | - | |
2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
5 | 3 | from __future__ import unicode_literals |
6 | 4 | |
7 | -from django.conf import settings | |
8 | 5 | from django.db import migrations, models |
9 | 6 | import django.db.models.deletion |
10 | 7 | import files.models |
... | ... | @@ -15,10 +12,8 @@ class Migration(migrations.Migration): |
15 | 12 | initial = True |
16 | 13 | |
17 | 14 | dependencies = [ |
18 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
19 | 15 | ('courses', '0001_initial'), |
20 | 16 | ('core', '0001_initial'), |
21 | - ('courses', '0001_initial'), | |
22 | 17 | ] |
23 | 18 | |
24 | 19 | operations = [ |
... | ... | @@ -29,12 +24,11 @@ class Migration(migrations.Migration): |
29 | 24 | ('description', models.TextField(blank=True, verbose_name='Description')), |
30 | 25 | ('file_url', models.FileField(upload_to=files.models.file_path, verbose_name='File')), |
31 | 26 | ('file_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topic_files', to='core.MimeType', verbose_name='Type file')), |
32 | - ('professor', models.ManyToManyField(related_name='file_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors')), | |
33 | 27 | ], |
34 | 28 | options={ |
29 | + 'verbose_name': 'File', | |
35 | 30 | 'ordering': ('-id',), |
36 | 31 | 'verbose_name_plural': 'Files', |
37 | - 'verbose_name': 'File', | |
38 | 32 | }, |
39 | 33 | bases=('courses.material',), |
40 | 34 | ), | ... | ... |
... | ... | @@ -0,0 +1,24 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
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 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
15 | + ('files', '0001_initial'), | |
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 | 1 | # -*- coding: utf-8 -*- |
2 | - | |
3 | -# Generated by Django 1.10 on 2016-11-16 20:54 | |
4 | - | |
2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
5 | 3 | from __future__ import unicode_literals |
6 | 4 | |
7 | -from django.conf import settings | |
8 | 5 | from django.db import migrations, models |
9 | 6 | import django.db.models.deletion |
10 | 7 | |
... | ... | @@ -14,7 +11,6 @@ class Migration(migrations.Migration): |
14 | 11 | initial = True |
15 | 12 | |
16 | 13 | dependencies = [ |
17 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
18 | 14 | ('courses', '0001_initial'), |
19 | 15 | ] |
20 | 16 | |
... | ... | @@ -28,8 +24,8 @@ class Migration(migrations.Migration): |
28 | 24 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Create Date')), |
29 | 25 | ], |
30 | 26 | options={ |
31 | - 'verbose_name_plural': 'Foruns', | |
32 | 27 | 'verbose_name': 'Forum', |
28 | + 'verbose_name_plural': 'Foruns', | |
33 | 29 | }, |
34 | 30 | bases=('courses.activity',), |
35 | 31 | ), |
... | ... | @@ -40,12 +36,10 @@ class Migration(migrations.Migration): |
40 | 36 | ('message', models.TextField(verbose_name='Post message')), |
41 | 37 | ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), |
42 | 38 | ('post_date', models.DateTimeField(auto_now_add=True, verbose_name='Post Date')), |
43 | - ('forum', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Forum', verbose_name='Forum')), | |
44 | - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor')), | |
45 | 39 | ], |
46 | 40 | options={ |
47 | - 'verbose_name_plural': 'Posts', | |
48 | 41 | 'verbose_name': 'Post', |
42 | + 'verbose_name_plural': 'Posts', | |
49 | 43 | }, |
50 | 44 | ), |
51 | 45 | migrations.CreateModel( |
... | ... | @@ -56,11 +50,10 @@ class Migration(migrations.Migration): |
56 | 50 | ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), |
57 | 51 | ('answer_date', models.DateTimeField(auto_now_add=True, verbose_name='Answer Date')), |
58 | 52 | ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Post', verbose_name='Post')), |
59 | - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor')), | |
60 | 53 | ], |
61 | 54 | options={ |
62 | - 'verbose_name_plural': 'Post Answers', | |
63 | 55 | 'verbose_name': 'Post Answer', |
56 | + 'verbose_name_plural': 'Post Answers', | |
64 | 57 | }, |
65 | 58 | ), |
66 | 59 | ] | ... | ... |
... | ... | @@ -0,0 +1,35 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
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 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
16 | + ('forum', '0001_initial'), | |
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 | + ] | ... | ... |
links/migrations/0001_initial.py
1 | 1 | # -*- coding: utf-8 -*- |
2 | - | |
3 | -# Generated by Django 1.10 on 2016-11-16 20:54 | |
2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
4 | 3 | from __future__ import unicode_literals |
5 | 4 | |
6 | 5 | from django.db import migrations, models |
... | ... | @@ -20,13 +19,13 @@ class Migration(migrations.Migration): |
20 | 19 | name='Link', |
21 | 20 | fields=[ |
22 | 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')), |
23 | - ('link_url', models.URLField()), | |
24 | - ('link_description', models.CharField(max_length=200)), | |
22 | + ('link_url', models.URLField(verbose_name='Link_URL')), | |
23 | + ('link_description', models.CharField(max_length=200, verbose_name='Description')), | |
25 | 24 | ('image', models.ImageField(blank=True, upload_to='links/')), |
26 | 25 | ], |
27 | 26 | options={ |
28 | - 'verbose_name_plural': 'Links', | |
29 | 27 | 'verbose_name': 'Link', |
28 | + 'verbose_name_plural': 'Links', | |
30 | 29 | }, |
31 | 30 | bases=('courses.material',), |
32 | 31 | ), | ... | ... |
links/migrations/0002_auto_20161116_1804.py
... | ... | @@ -1,25 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-11-16 21: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 | - ('links', '0001_initial'), | |
12 | - ] | |
13 | - | |
14 | - operations = [ | |
15 | - migrations.AlterField( | |
16 | - model_name='link', | |
17 | - name='link_description', | |
18 | - field=models.CharField(max_length=200, verbose_name='Description'), | |
19 | - ), | |
20 | - migrations.AlterField( | |
21 | - model_name='link', | |
22 | - name='link_url', | |
23 | - field=models.URLField(verbose_name='Link_URL'), | |
24 | - ), | |
25 | - ] |
poll/migrations/0001_initial.py
1 | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-11-16 20:54 | |
2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
3 | 3 | from __future__ import unicode_literals |
4 | 4 | |
5 | -from django.conf import settings | |
6 | 5 | from django.db import migrations, models |
7 | 6 | import django.db.models.deletion |
8 | 7 | |
... | ... | @@ -12,7 +11,6 @@ class Migration(migrations.Migration): |
12 | 11 | initial = True |
13 | 12 | |
14 | 13 | dependencies = [ |
15 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
16 | 14 | ('courses', '0001_initial'), |
17 | 15 | ] |
18 | 16 | |
... | ... | @@ -25,9 +23,9 @@ class Migration(migrations.Migration): |
25 | 23 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), |
26 | 24 | ], |
27 | 25 | options={ |
28 | - 'verbose_name_plural': 'Answers', | |
29 | - 'ordering': ('order',), | |
30 | 26 | 'verbose_name': 'Answer', |
27 | + 'ordering': ('order',), | |
28 | + 'verbose_name_plural': 'Answers', | |
31 | 29 | }, |
32 | 30 | ), |
33 | 31 | migrations.CreateModel( |
... | ... | @@ -39,8 +37,8 @@ class Migration(migrations.Migration): |
39 | 37 | ('answer', models.ManyToManyField(related_name='answers_stundet', to='poll.Answer', verbose_name='Answers Students')), |
40 | 38 | ], |
41 | 39 | options={ |
42 | - 'verbose_name_plural': 'Answers Student', | |
43 | 40 | 'verbose_name': 'Answer Stundent', |
41 | + 'verbose_name_plural': 'Answers Student', | |
44 | 42 | }, |
45 | 43 | ), |
46 | 44 | migrations.CreateModel( |
... | ... | @@ -49,8 +47,8 @@ class Migration(migrations.Migration): |
49 | 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 | 49 | options={ |
52 | - 'verbose_name_plural': 'Polls', | |
53 | 50 | 'verbose_name': 'Poll', |
51 | + 'verbose_name_plural': 'Polls', | |
54 | 52 | }, |
55 | 53 | bases=('courses.activity',), |
56 | 54 | ), |
... | ... | @@ -59,14 +57,4 @@ class Migration(migrations.Migration): |
59 | 57 | name='poll', |
60 | 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 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
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 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
16 | + ('poll', '0001_initial'), | |
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 | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-11-16 20:54 | |
2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
3 | 3 | from __future__ import unicode_literals |
4 | 4 | |
5 | 5 | import django.contrib.auth.models |
... | ... | @@ -46,8 +46,8 @@ class Migration(migrations.Migration): |
46 | 46 | ('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')), |
47 | 47 | ], |
48 | 48 | options={ |
49 | - 'verbose_name_plural': 'Users', | |
50 | 49 | 'verbose_name': 'User', |
50 | + 'verbose_name_plural': 'Users', | |
51 | 51 | }, |
52 | 52 | managers=[ |
53 | 53 | ('objects', django.contrib.auth.models.UserManager()), | ... | ... |