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 | 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 | 3 | from __future__ import unicode_literals |
4 | 4 | |
5 | 5 | import autoslug.fields |
6 | -from django.conf import settings | |
7 | 6 | from django.db import migrations, models |
8 | 7 | import django.db.models.deletion |
9 | 8 | |
... | ... | @@ -13,7 +12,6 @@ class Migration(migrations.Migration): |
13 | 12 | initial = True |
14 | 13 | |
15 | 14 | dependencies = [ |
16 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
17 | 15 | ] |
18 | 16 | |
19 | 17 | operations = [ |
... | ... | @@ -33,7 +31,6 @@ class Migration(migrations.Migration): |
33 | 31 | name='Action_Resource', |
34 | 32 | fields=[ |
35 | 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 | 35 | options={ |
39 | 36 | 'verbose_name': 'Action_Resource', |
... | ... | @@ -45,8 +42,6 @@ class Migration(migrations.Migration): |
45 | 42 | fields=[ |
46 | 43 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
47 | 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 | 46 | options={ |
52 | 47 | 'verbose_name': 'Log', |
... | ... | @@ -73,8 +68,6 @@ class Migration(migrations.Migration): |
73 | 68 | ('read', models.BooleanField(default=False, verbose_name='Read')), |
74 | 69 | ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), |
75 | 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 | 72 | options={ |
80 | 73 | 'verbose_name': 'Notification', |
... | ... | @@ -95,9 +88,4 @@ class Migration(migrations.Migration): |
95 | 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 @@ |
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 | 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 | 3 | from __future__ import unicode_literals |
4 | 4 | |
5 | 5 | import autoslug.fields |
6 | -from django.conf import settings | |
7 | 6 | from django.db import migrations, models |
8 | 7 | import django.db.models.deletion |
9 | 8 | import s3direct.fields |
... | ... | @@ -15,7 +14,6 @@ class Migration(migrations.Migration): |
15 | 14 | |
16 | 15 | dependencies = [ |
17 | 16 | ('core', '0001_initial'), |
18 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
19 | 17 | ] |
20 | 18 | |
21 | 19 | operations = [ |
... | ... | @@ -25,7 +23,6 @@ class Migration(migrations.Migration): |
25 | 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 | 24 | ('limit_date', models.DateField(verbose_name='Deliver Date')), |
27 | 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 | 27 | bases=('core.resource',), |
31 | 28 | ), |
... | ... | @@ -35,11 +32,10 @@ class Migration(migrations.Migration): |
35 | 32 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
36 | 33 | ('pdf', s3direct.fields.S3DirectField()), |
37 | 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 | 36 | options={ |
41 | - 'verbose_name_plural': 'Activitys Files', | |
42 | 37 | 'verbose_name': 'Activity File', |
38 | + 'verbose_name_plural': 'Activitys Files', | |
43 | 39 | }, |
44 | 40 | ), |
45 | 41 | migrations.CreateModel( |
... | ... | @@ -51,8 +47,8 @@ class Migration(migrations.Migration): |
51 | 47 | ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), |
52 | 48 | ], |
53 | 49 | options={ |
54 | - 'verbose_name_plural': 'Categories', | |
55 | 50 | 'verbose_name': 'Category', |
51 | + 'verbose_name_plural': 'Categories', | |
56 | 52 | }, |
57 | 53 | ), |
58 | 54 | migrations.CreateModel( |
... | ... | @@ -72,9 +68,9 @@ class Migration(migrations.Migration): |
72 | 68 | ('image', models.ImageField(blank=True, upload_to='courses/', verbose_name='Image')), |
73 | 69 | ], |
74 | 70 | options={ |
71 | + 'verbose_name': 'Course', | |
75 | 72 | 'verbose_name_plural': 'Courses', |
76 | 73 | 'ordering': ('create_date', 'name'), |
77 | - 'verbose_name': 'Course', | |
78 | 74 | }, |
79 | 75 | ), |
80 | 76 | migrations.CreateModel( |
... | ... | @@ -86,8 +82,8 @@ class Migration(migrations.Migration): |
86 | 82 | ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), |
87 | 83 | ], |
88 | 84 | options={ |
89 | - 'verbose_name_plural': 'Categories', | |
90 | 85 | 'verbose_name': 'Category', |
86 | + 'verbose_name_plural': 'Categories', | |
91 | 87 | }, |
92 | 88 | ), |
93 | 89 | migrations.CreateModel( |
... | ... | @@ -112,7 +108,6 @@ class Migration(migrations.Migration): |
112 | 108 | fields=[ |
113 | 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 | 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 | 112 | bases=('core.resource',), |
118 | 113 | ), |
... | ... | @@ -128,15 +123,11 @@ class Migration(migrations.Migration): |
128 | 123 | ('end_date', models.DateField(verbose_name='End of Subject Date')), |
129 | 124 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), |
130 | 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 | 127 | options={ |
128 | + 'verbose_name': 'Subject', | |
137 | 129 | 'verbose_name_plural': 'Subjects', |
138 | 130 | 'ordering': ('create_date', 'name'), |
139 | - 'verbose_name': 'Subject', | |
140 | 131 | }, |
141 | 132 | ), |
142 | 133 | migrations.CreateModel( |
... | ... | @@ -146,11 +137,10 @@ class Migration(migrations.Migration): |
146 | 137 | ('name', models.CharField(max_length=100, verbose_name='Name')), |
147 | 138 | ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), |
148 | 139 | ('description', models.TextField(blank=True, verbose_name='Description')), |
149 | - ('subjects', models.ManyToManyField(to='courses.Subject')), | |
150 | 140 | ], |
151 | 141 | options={ |
152 | - 'verbose_name_plural': 'subject categories', | |
153 | 142 | 'verbose_name': 'subject category', |
143 | + 'verbose_name_plural': 'subject categories', | |
154 | 144 | }, |
155 | 145 | ), |
156 | 146 | migrations.CreateModel( |
... | ... | @@ -163,48 +153,11 @@ class Migration(migrations.Migration): |
163 | 153 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), |
164 | 154 | ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), |
165 | 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 | 157 | options={ |
158 | + 'verbose_name': 'Topic', | |
170 | 159 | 'verbose_name_plural': 'Topics', |
171 | 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 @@ |
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 | 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 | 84 | <ul class="dropdown-menu" aria-labelledby="dLabel"> |
85 | 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 | 88 | </ul> |
87 | 89 | </div> |
88 | 90 | </div> |
... | ... | @@ -133,7 +135,6 @@ |
133 | 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 | 136 | <ul class="dropdown-menu" aria-labelledby="dLabel"> |
135 | 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 | 138 | </ul> |
138 | 139 | </div> |
139 | 140 | </div> | ... | ... |
... | ... | @@ -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 @@ |
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 | 1 | from django import template |
2 | 2 | |
3 | +from links.models import Link | |
3 | 4 | from forum.models import Forum |
4 | 5 | from poll.models import Poll |
5 | 6 | from files.models import TopicFile |
... | ... | @@ -51,3 +52,21 @@ def list_topic_file_edit(request, topic): |
51 | 52 | context['topic'] = topic |
52 | 53 | |
53 | 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 | 30 | url(r'^exam/', include('exam.urls', namespace = 'exam')), |
31 | 31 | url(r'^files/', include('files.urls', namespace = 'file')), |
32 | 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 | 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 | 3 | from __future__ import unicode_literals |
4 | 4 | |
5 | 5 | from django.db import migrations, models |
... | ... | @@ -23,8 +23,8 @@ class Migration(migrations.Migration): |
23 | 23 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), |
24 | 24 | ], |
25 | 25 | options={ |
26 | - 'verbose_name_plural': 'Answers', | |
27 | 26 | 'verbose_name': 'Answer', |
27 | + 'verbose_name_plural': 'Answers', | |
28 | 28 | 'ordering': ('order',), |
29 | 29 | }, |
30 | 30 | ), |
... | ... | @@ -35,8 +35,8 @@ class Migration(migrations.Migration): |
35 | 35 | ('begin_date', models.DateField(blank=True, verbose_name='Begin of Course Date')), |
36 | 36 | ], |
37 | 37 | options={ |
38 | - 'verbose_name_plural': 'Exams', | |
39 | 38 | 'verbose_name': 'Exam', |
39 | + 'verbose_name_plural': 'Exams', | |
40 | 40 | }, |
41 | 41 | bases=('courses.activity',), |
42 | 42 | ), | ... | ... |
files/migrations/0001_initial.py
1 | 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 | 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 | import files.models |
... | ... | @@ -13,9 +12,8 @@ class Migration(migrations.Migration): |
13 | 12 | initial = True |
14 | 13 | |
15 | 14 | dependencies = [ |
16 | - ('courses', '0001_initial'), | |
17 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
18 | 15 | ('core', '0001_initial'), |
16 | + ('courses', '0001_initial'), | |
19 | 17 | ] |
20 | 18 | |
21 | 19 | operations = [ |
... | ... | @@ -26,11 +24,10 @@ class Migration(migrations.Migration): |
26 | 24 | ('description', models.TextField(blank=True, verbose_name='Description')), |
27 | 25 | ('file_url', models.FileField(upload_to=files.models.file_path, verbose_name='File')), |
28 | 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 | 28 | options={ |
32 | - 'verbose_name_plural': 'Files', | |
33 | 29 | 'verbose_name': 'File', |
30 | + 'verbose_name_plural': 'Files', | |
34 | 31 | 'ordering': ('-id',), |
35 | 32 | }, |
36 | 33 | bases=('courses.material',), | ... | ... |
... | ... | @@ -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 | 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 | 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 | |
... | ... | @@ -38,8 +36,6 @@ class Migration(migrations.Migration): |
38 | 36 | ('message', models.TextField(verbose_name='Post message')), |
39 | 37 | ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), |
40 | 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 | 40 | options={ |
45 | 41 | 'verbose_name': 'Post', |
... | ... | @@ -54,7 +50,6 @@ class Migration(migrations.Migration): |
54 | 50 | ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), |
55 | 51 | ('answer_date', models.DateTimeField(auto_now_add=True, verbose_name='Answer Date')), |
56 | 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 | 54 | options={ |
60 | 55 | 'verbose_name': 'Post Answer', | ... | ... |
... | ... | @@ -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 | 93 | ) |
94 | 94 | self.post_student.save() |
95 | 95 | |
96 | - self.answer = PostAnswer.objects.create( | |
96 | + self.answerStudent = PostAnswer.objects.create( | |
97 | 97 | user = self.user_student, |
98 | 98 | post = self.post_professor, |
99 | 99 | message = 'testing a post answer', |
100 | 100 | modification_date = '2016-10-05', |
101 | 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 | 114 | def test_create_answer_post (self): |
115 | + list_answers = PostAnswer.objects.filter(user=self.user_professor).count() | |
106 | 116 | answer = PostAnswer.objects.create( |
107 | 117 | user = self.user_professor, |
108 | 118 | post = self.post_student, |
... | ... | @@ -112,19 +122,46 @@ class PostAnswerTestCase (TestCase): |
112 | 122 | ) |
113 | 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 | 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 | 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 | 169 | \ No newline at end of file | ... | ... |
forum/tests/test_model_forum.py
... | ... | @@ -77,7 +77,9 @@ class ForumTestCase (TestCase): |
77 | 77 | self.forum.save() |
78 | 78 | |
79 | 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 | 83 | topic=self.topic, |
82 | 84 | name = 'forum test2', |
83 | 85 | description = 'description of the forum test', |
... | ... | @@ -85,22 +87,20 @@ class ForumTestCase (TestCase): |
85 | 87 | modification_date = '2016-10-03', |
86 | 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 | 96 | self.forum.name = 'forum test updated' |
94 | 97 | self.forum.save() |
95 | 98 | |
96 | 99 | self.assertEquals(self.forum, Forum.objects.get(name='forum test updated')) |
100 | + self.assertEquals(list_forum, Forum.objects.all().count()) | |
97 | 101 | |
98 | 102 | def test_delete_forum (self): |
99 | - forum = Forum.objects.get(name='forum test') | |
103 | + list_forum = Forum.objects.all().count() | |
100 | 104 | self.forum.delete() |
101 | 105 | |
102 | - try: | |
103 | - forum = Forum.objects.get(name='forum test') | |
104 | - except: | |
105 | - pass | |
106 | - | |
107 | 106 | \ No newline at end of file |
107 | + self.assertEquals(list_forum-1, Forum.objects.all().count()) | |
108 | 108 | \ No newline at end of file | ... | ... |
forum/tests/test_model_post.py
... | ... | @@ -94,6 +94,8 @@ class PostTestCase (TestCase): |
94 | 94 | self.post_student.save() |
95 | 95 | |
96 | 96 | def test_create_post_professor (self): |
97 | + list_post = Post.objects.all().count() | |
98 | + | |
97 | 99 | post_professor = Post.objects.create( |
98 | 100 | user = self.user_professor, |
99 | 101 | message = 'posting', |
... | ... | @@ -103,9 +105,11 @@ class PostTestCase (TestCase): |
103 | 105 | ) |
104 | 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 | 110 | def test_create_post_student (self): |
111 | + list_post = Post.objects.all().count() | |
112 | + | |
109 | 113 | post_student = Post.objects.create( |
110 | 114 | user = self.user_student, |
111 | 115 | message = 'posting', |
... | ... | @@ -115,34 +119,35 @@ class PostTestCase (TestCase): |
115 | 119 | ) |
116 | 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 | 124 | def test_update_post_professor (self): |
125 | + list_post = Post.objects.all().count() | |
121 | 126 | self.post_professor.message = 'updating a post as professor' |
122 | 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 | 132 | def test_update_post_student (self): |
133 | + list_post = Post.objects.all().count() | |
127 | 134 | self.post_student.message = 'updating a post as student' |
128 | 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 | 140 | def test_delete_post_professor (self): |
141 | + list_post = Post.objects.all().count() | |
142 | + | |
133 | 143 | post = Post.objects.get(user=self.user_professor, message='posting a test on forum as professor') |
134 | 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 | 148 | def test_delete_post_student (self): |
149 | + list_post = Post.objects.all().count() | |
142 | 150 | post = Post.objects.get(user=self.user_student, message='posting a test on forum as student') |
143 | 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 | 153 | \ No newline at end of file |
154 | + self.assertEquals(list_post-1, Post.objects.all().count()) | |
150 | 155 | \ No newline at end of file | ... | ... |
links/admin.py
... | ... | @@ -3,8 +3,8 @@ from django.contrib import admin |
3 | 3 | from .models import Link |
4 | 4 | |
5 | 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 | 10 | admin.site.register(Link, LinkAdmin) | ... | ... |
links/forms.py
... | ... | @@ -5,16 +5,16 @@ import validators |
5 | 5 | class CreateLinkForm(forms.ModelForm): |
6 | 6 | |
7 | 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 | 10 | raise forms.ValidationError(_('Please enter a valid URL')) |
11 | - return link | |
11 | + return link_url | |
12 | 12 | |
13 | 13 | class Meta: |
14 | 14 | model = Link |
15 | - fields = ['name','link','description'] | |
15 | + fields = ['name','link_url','link_description'] | |
16 | 16 | |
17 | 17 | class UpdateLinkForm(forms.ModelForm): |
18 | 18 | class Meta: |
19 | 19 | model = Link |
20 | - fields = ['name','link','description'] | |
20 | + fields = ['name','link_url','link_description'] | ... | ... |
links/migrations/0001_initial.py
1 | 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 | 3 | from __future__ import unicode_literals |
4 | 4 | |
5 | 5 | from django.db import migrations, models |
6 | +import django.db.models.deletion | |
6 | 7 | |
7 | 8 | |
8 | 9 | class Migration(migrations.Migration): |
... | ... | @@ -10,20 +11,21 @@ class Migration(migrations.Migration): |
10 | 11 | initial = True |
11 | 12 | |
12 | 13 | dependencies = [ |
14 | + ('courses', '0001_initial'), | |
13 | 15 | ] |
14 | 16 | |
15 | 17 | operations = [ |
16 | 18 | migrations.CreateModel( |
17 | 19 | name='Link', |
18 | 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 | 25 | options={ |
25 | - 'verbose_name_plural': 'Links', | |
26 | 26 | 'verbose_name': 'Link', |
27 | + 'verbose_name_plural': 'Links', | |
27 | 28 | }, |
29 | + bases=('courses.material',), | |
28 | 30 | ), |
29 | 31 | ] | ... | ... |
links/models.py
1 | - | |
2 | 1 | from django.db import models |
3 | 2 | from courses.models import Material |
4 | 3 | from autoslug.fields import AutoSlugField |
5 | 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 | 8 | class Meta: |
11 | 9 | verbose_name = 'Link' |
12 | 10 | verbose_name_plural = "Links" | ... | ... |
links/urls.py
... | ... | @@ -2,5 +2,7 @@ from django.conf.urls import url, include |
2 | 2 | from . import views |
3 | 3 | |
4 | 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 | 13 | template_name = 'links/create_link.html' |
14 | 14 | form_class = CreateLinkForm |
15 | 15 | success_url = reverse_lazy('course:manage') |
16 | - context_object_name = 'links' | |
16 | + context_object_name = 'form' | |
17 | 17 | |
18 | 18 | def form_valid(self, form): |
19 | 19 | form.save() |
... | ... | @@ -26,7 +26,6 @@ class CreateLink(generic.CreateView): |
26 | 26 | context['form'] = CreateLinkForm |
27 | 27 | return context |
28 | 28 | |
29 | - | |
30 | 29 | def deleteLink(request,linkname): |
31 | 30 | link = get_object_or_404(Link,name = linkname) |
32 | 31 | link.delete() | ... | ... |
poll/migrations/0001_initial.py
1 | 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 | 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 | |
... | ... | @@ -13,7 +12,6 @@ class Migration(migrations.Migration): |
13 | 12 | |
14 | 13 | dependencies = [ |
15 | 14 | ('courses', '0001_initial'), |
16 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
17 | 15 | ] |
18 | 16 | |
19 | 17 | operations = [ |
... | ... | @@ -25,8 +23,8 @@ class Migration(migrations.Migration): |
25 | 23 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), |
26 | 24 | ], |
27 | 25 | options={ |
28 | - 'verbose_name_plural': 'Answers', | |
29 | 26 | 'verbose_name': 'Answer', |
27 | + 'verbose_name_plural': 'Answers', | |
30 | 28 | 'ordering': ('order',), |
31 | 29 | }, |
32 | 30 | ), |
... | ... | @@ -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-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 | 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 | 3 | from __future__ import unicode_literals |
4 | 4 | |
5 | 5 | import django.contrib.auth.models |
... | ... | @@ -42,8 +42,8 @@ class Migration(migrations.Migration): |
42 | 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 | 44 | options={ |
45 | - 'verbose_name_plural': 'Users', | |
46 | 45 | 'verbose_name': 'User', |
46 | + 'verbose_name_plural': 'Users', | |
47 | 47 | }, |
48 | 48 | managers=[ |
49 | 49 | ('objects', django.contrib.auth.models.UserManager()), | ... | ... |