Commit 1846ce70a5173e470aa09cff5e5c78c1eb3f65d3
Exists in
master
and in
5 other branches
conflito settings
Showing
23 changed files
with
191 additions
and
263 deletions
Show diff stats
amadeus/settings.py
@@ -47,15 +47,16 @@ INSTALLED_APPS = [ | @@ -47,15 +47,16 @@ INSTALLED_APPS = [ | ||
47 | 'rolepermissions', | 47 | 'rolepermissions', |
48 | 'rest_framework', | 48 | 'rest_framework', |
49 | 'django_bootstrap_breadcrumbs', | 49 | 'django_bootstrap_breadcrumbs', |
50 | + 's3direct', | ||
50 | 51 | ||
52 | + 'users', | ||
51 | 'core', | 53 | 'core', |
52 | 'app', | 54 | 'app', |
53 | 'courses', | 55 | 'courses', |
54 | - 'users', | ||
55 | 'forum', | 56 | 'forum', |
56 | 'poll', | 57 | 'poll', |
57 | 'avaliacao', | 58 | 'avaliacao', |
58 | - 's3direct', | 59 | + |
59 | ] | 60 | ] |
60 | 61 | ||
61 | MIDDLEWARE_CLASSES = [ | 62 | MIDDLEWARE_CLASSES = [ |
@@ -206,7 +207,6 @@ S3DIRECT_DESTINATIONS = { | @@ -206,7 +207,6 @@ S3DIRECT_DESTINATIONS = { | ||
206 | 207 | ||
207 | } | 208 | } |
208 | 209 | ||
209 | - | ||
210 | try: | 210 | try: |
211 | from .local_settings import * | 211 | from .local_settings import * |
212 | except ImportError: | 212 | except ImportError: |
core/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-02 00:17 | 2 | +# Generated by Django 1.10 on 2016-10-05 02:05 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | import autoslug.fields | 5 | import autoslug.fields |
6 | +from django.conf import settings | ||
6 | from django.db import migrations, models | 7 | from django.db import migrations, models |
7 | import django.db.models.deletion | 8 | import django.db.models.deletion |
8 | 9 | ||
@@ -12,6 +13,7 @@ class Migration(migrations.Migration): | @@ -12,6 +13,7 @@ class Migration(migrations.Migration): | ||
12 | initial = True | 13 | initial = True |
13 | 14 | ||
14 | dependencies = [ | 15 | dependencies = [ |
16 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
15 | ] | 17 | ] |
16 | 18 | ||
17 | operations = [ | 19 | operations = [ |
@@ -23,18 +25,19 @@ class Migration(migrations.Migration): | @@ -23,18 +25,19 @@ class Migration(migrations.Migration): | ||
23 | ('created_date', models.DateField(auto_now_add=True, verbose_name='Created Date')), | 25 | ('created_date', models.DateField(auto_now_add=True, verbose_name='Created Date')), |
24 | ], | 26 | ], |
25 | options={ | 27 | options={ |
26 | - 'verbose_name': 'Action', | ||
27 | 'verbose_name_plural': 'Actions', | 28 | 'verbose_name_plural': 'Actions', |
29 | + 'verbose_name': 'Action', | ||
28 | }, | 30 | }, |
29 | ), | 31 | ), |
30 | migrations.CreateModel( | 32 | migrations.CreateModel( |
31 | name='Action_Resource', | 33 | name='Action_Resource', |
32 | fields=[ | 34 | fields=[ |
33 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | 35 | ('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')), | ||
34 | ], | 37 | ], |
35 | options={ | 38 | options={ |
36 | - 'verbose_name': 'Action_Resource', | ||
37 | 'verbose_name_plural': 'Action_Resources', | 39 | 'verbose_name_plural': 'Action_Resources', |
40 | + 'verbose_name': 'Action_Resource', | ||
38 | }, | 41 | }, |
39 | ), | 42 | ), |
40 | migrations.CreateModel( | 43 | migrations.CreateModel( |
@@ -42,10 +45,12 @@ class Migration(migrations.Migration): | @@ -42,10 +45,12 @@ class Migration(migrations.Migration): | ||
42 | fields=[ | 45 | fields=[ |
43 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | 46 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
44 | ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), | 47 | ('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')), | ||
45 | ], | 50 | ], |
46 | options={ | 51 | options={ |
47 | - 'verbose_name': 'Log', | ||
48 | 'verbose_name_plural': 'Logs', | 52 | 'verbose_name_plural': 'Logs', |
53 | + 'verbose_name': 'Log', | ||
49 | }, | 54 | }, |
50 | ), | 55 | ), |
51 | migrations.CreateModel( | 56 | migrations.CreateModel( |
@@ -56,10 +61,12 @@ class Migration(migrations.Migration): | @@ -56,10 +61,12 @@ class Migration(migrations.Migration): | ||
56 | ('read', models.BooleanField(default=False, verbose_name='Read')), | 61 | ('read', models.BooleanField(default=False, verbose_name='Read')), |
57 | ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), | 62 | ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), |
58 | ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')), | 63 | ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')), |
64 | + ('actor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notification_Performer', to=settings.AUTH_USER_MODEL, verbose_name='Perfomer')), | ||
65 | + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User')), | ||
59 | ], | 66 | ], |
60 | options={ | 67 | options={ |
61 | - 'verbose_name': 'Notification', | ||
62 | 'verbose_name_plural': 'Notifications', | 68 | 'verbose_name_plural': 'Notifications', |
69 | + 'verbose_name': 'Notification', | ||
63 | }, | 70 | }, |
64 | ), | 71 | ), |
65 | migrations.CreateModel( | 72 | migrations.CreateModel( |
@@ -72,8 +79,13 @@ class Migration(migrations.Migration): | @@ -72,8 +79,13 @@ class Migration(migrations.Migration): | ||
72 | ('url', models.CharField(default='', max_length=100, verbose_name='URL')), | 79 | ('url', models.CharField(default='', max_length=100, verbose_name='URL')), |
73 | ], | 80 | ], |
74 | options={ | 81 | options={ |
75 | - 'verbose_name': 'Resource', | ||
76 | 'verbose_name_plural': 'Resources', | 82 | 'verbose_name_plural': 'Resources', |
83 | + 'verbose_name': 'Resource', | ||
77 | }, | 84 | }, |
78 | ), | 85 | ), |
86 | + migrations.AddField( | ||
87 | + model_name='action_resource', | ||
88 | + name='resource', | ||
89 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Resource', verbose_name='Resource'), | ||
90 | + ), | ||
79 | ] | 91 | ] |
core/migrations/0002_auto_20161001_2117.py
@@ -1,50 +0,0 @@ | @@ -1,50 +0,0 @@ | ||
1 | -# -*- coding: utf-8 -*- | ||
2 | -# Generated by Django 1.10 on 2016-10-02 00:17 | ||
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='Perfomer'), | ||
24 | - ), | ||
25 | - migrations.AddField( | ||
26 | - model_name='notification', | ||
27 | - name='user', | ||
28 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User'), | ||
29 | - ), | ||
30 | - migrations.AddField( | ||
31 | - model_name='log', | ||
32 | - name='action_resource', | ||
33 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource'), | ||
34 | - ), | ||
35 | - migrations.AddField( | ||
36 | - model_name='log', | ||
37 | - name='user', | ||
38 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor'), | ||
39 | - ), | ||
40 | - migrations.AddField( | ||
41 | - model_name='action_resource', | ||
42 | - name='action', | ||
43 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied'), | ||
44 | - ), | ||
45 | - migrations.AddField( | ||
46 | - model_name='action_resource', | ||
47 | - name='resource', | ||
48 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Resource', verbose_name='Resource'), | ||
49 | - ), | ||
50 | - ] |
courses/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-02 00:17 | 2 | +# Generated by Django 1.10 on 2016-10-05 02:05 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | import autoslug.fields | 5 | import autoslug.fields |
6 | +from django.conf import settings | ||
6 | from django.db import migrations, models | 7 | from django.db import migrations, models |
7 | import django.db.models.deletion | 8 | import django.db.models.deletion |
9 | +import s3direct.fields | ||
8 | 10 | ||
9 | 11 | ||
10 | class Migration(migrations.Migration): | 12 | class Migration(migrations.Migration): |
@@ -13,6 +15,7 @@ class Migration(migrations.Migration): | @@ -13,6 +15,7 @@ class Migration(migrations.Migration): | ||
13 | 15 | ||
14 | dependencies = [ | 16 | dependencies = [ |
15 | ('core', '0001_initial'), | 17 | ('core', '0001_initial'), |
18 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
16 | ] | 19 | ] |
17 | 20 | ||
18 | operations = [ | 21 | operations = [ |
@@ -22,10 +25,24 @@ class Migration(migrations.Migration): | @@ -22,10 +25,24 @@ class Migration(migrations.Migration): | ||
22 | ('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')), | 25 | ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), |
23 | ('limit_date', models.DateTimeField(verbose_name='Deliver Date')), | 26 | ('limit_date', models.DateTimeField(verbose_name='Deliver Date')), |
24 | ('all_students', models.BooleanField(default=False, verbose_name='All Students')), | 27 | ('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')), | ||
25 | ], | 29 | ], |
26 | bases=('core.resource',), | 30 | bases=('core.resource',), |
27 | ), | 31 | ), |
28 | migrations.CreateModel( | 32 | migrations.CreateModel( |
33 | + name='ActivityFile', | ||
34 | + fields=[ | ||
35 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
36 | + ('pdf', s3direct.fields.S3DirectField()), | ||
37 | + ('name', models.CharField(max_length=100)), | ||
38 | + ('diet', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='courses.Activity')), | ||
39 | + ], | ||
40 | + options={ | ||
41 | + 'verbose_name_plural': 'Activitys Files', | ||
42 | + 'verbose_name': 'Activity File', | ||
43 | + }, | ||
44 | + ), | ||
45 | + migrations.CreateModel( | ||
29 | name='Category', | 46 | name='Category', |
30 | fields=[ | 47 | fields=[ |
31 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | 48 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
@@ -34,8 +51,8 @@ class Migration(migrations.Migration): | @@ -34,8 +51,8 @@ class Migration(migrations.Migration): | ||
34 | ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), | 51 | ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), |
35 | ], | 52 | ], |
36 | options={ | 53 | options={ |
37 | - 'verbose_name': 'Category', | ||
38 | 'verbose_name_plural': 'Categories', | 54 | 'verbose_name_plural': 'Categories', |
55 | + 'verbose_name': 'Category', | ||
39 | }, | 56 | }, |
40 | ), | 57 | ), |
41 | migrations.CreateModel( | 58 | migrations.CreateModel( |
@@ -53,11 +70,14 @@ class Migration(migrations.Migration): | @@ -53,11 +70,14 @@ class Migration(migrations.Migration): | ||
53 | ('init_date', models.DateField(verbose_name='Begin of Course Date')), | 70 | ('init_date', models.DateField(verbose_name='Begin of Course Date')), |
54 | ('end_date', models.DateField(verbose_name='End of Course Date')), | 71 | ('end_date', models.DateField(verbose_name='End of Course Date')), |
55 | ('image', models.ImageField(blank=True, upload_to='courses/', verbose_name='Image')), | 72 | ('image', models.ImageField(blank=True, upload_to='courses/', verbose_name='Image')), |
73 | + ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Category', verbose_name='Category')), | ||
74 | + ('professors', models.ManyToManyField(related_name='courses_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors')), | ||
75 | + ('students', models.ManyToManyField(related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students')), | ||
56 | ], | 76 | ], |
57 | options={ | 77 | options={ |
58 | 'ordering': ('create_date', 'name'), | 78 | 'ordering': ('create_date', 'name'), |
59 | - 'verbose_name': 'Course', | ||
60 | 'verbose_name_plural': 'Courses', | 79 | 'verbose_name_plural': 'Courses', |
80 | + 'verbose_name': 'Course', | ||
61 | }, | 81 | }, |
62 | ), | 82 | ), |
63 | migrations.CreateModel( | 83 | migrations.CreateModel( |
@@ -65,6 +85,7 @@ class Migration(migrations.Migration): | @@ -65,6 +85,7 @@ class Migration(migrations.Migration): | ||
65 | fields=[ | 85 | fields=[ |
66 | ('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')), | 86 | ('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')), |
67 | ('all_students', models.BooleanField(default=False, verbose_name='All Students')), | 87 | ('all_students', models.BooleanField(default=False, verbose_name='All Students')), |
88 | + ('students', models.ManyToManyField(related_name='materials', to=settings.AUTH_USER_MODEL, verbose_name='Students')), | ||
68 | ], | 89 | ], |
69 | bases=('core.resource',), | 90 | bases=('core.resource',), |
70 | ), | 91 | ), |
@@ -80,11 +101,13 @@ class Migration(migrations.Migration): | @@ -80,11 +101,13 @@ class Migration(migrations.Migration): | ||
80 | ('end_date', models.DateField(verbose_name='End of Subject Date')), | 101 | ('end_date', models.DateField(verbose_name='End of Subject Date')), |
81 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), | 102 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), |
82 | ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), | 103 | ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), |
104 | + ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course')), | ||
105 | + ('professors', models.ManyToManyField(related_name='subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors')), | ||
83 | ], | 106 | ], |
84 | options={ | 107 | options={ |
85 | 'ordering': ('create_date', 'name'), | 108 | 'ordering': ('create_date', 'name'), |
86 | - 'verbose_name': 'Subject', | ||
87 | 'verbose_name_plural': 'Subjects', | 109 | 'verbose_name_plural': 'Subjects', |
110 | + 'verbose_name': 'Subject', | ||
88 | }, | 111 | }, |
89 | ), | 112 | ), |
90 | migrations.CreateModel( | 113 | migrations.CreateModel( |
@@ -94,10 +117,11 @@ class Migration(migrations.Migration): | @@ -94,10 +117,11 @@ class Migration(migrations.Migration): | ||
94 | ('name', models.CharField(max_length=100, verbose_name='Name')), | 117 | ('name', models.CharField(max_length=100, verbose_name='Name')), |
95 | ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), | 118 | ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), |
96 | ('description', models.TextField(blank=True, verbose_name='Description')), | 119 | ('description', models.TextField(blank=True, verbose_name='Description')), |
120 | + ('subjects', models.ManyToManyField(to='courses.Subject')), | ||
97 | ], | 121 | ], |
98 | options={ | 122 | options={ |
99 | - 'verbose_name': 'subject category', | ||
100 | 'verbose_name_plural': 'subject categories', | 123 | 'verbose_name_plural': 'subject categories', |
124 | + 'verbose_name': 'subject category', | ||
101 | }, | 125 | }, |
102 | ), | 126 | ), |
103 | migrations.CreateModel( | 127 | migrations.CreateModel( |
@@ -110,11 +134,23 @@ class Migration(migrations.Migration): | @@ -110,11 +134,23 @@ class Migration(migrations.Migration): | ||
110 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), | 134 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), |
111 | ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), | 135 | ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), |
112 | ('visible', models.BooleanField(default=False, verbose_name='Visible')), | 136 | ('visible', models.BooleanField(default=False, verbose_name='Visible')), |
137 | + ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Owner')), | ||
138 | + ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject')), | ||
113 | ], | 139 | ], |
114 | options={ | 140 | options={ |
115 | 'ordering': ('create_date', 'name'), | 141 | 'ordering': ('create_date', 'name'), |
116 | - 'verbose_name': 'Topic', | ||
117 | 'verbose_name_plural': 'Topics', | 142 | 'verbose_name_plural': 'Topics', |
143 | + 'verbose_name': 'Topic', | ||
118 | }, | 144 | }, |
119 | ), | 145 | ), |
146 | + migrations.AddField( | ||
147 | + model_name='material', | ||
148 | + name='topic', | ||
149 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'), | ||
150 | + ), | ||
151 | + migrations.AddField( | ||
152 | + model_name='activity', | ||
153 | + name='topic', | ||
154 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'), | ||
155 | + ), | ||
120 | ] | 156 | ] |
courses/migrations/0002_auto_20161001_2117.py
@@ -1,80 +0,0 @@ | @@ -1,80 +0,0 @@ | ||
1 | -# -*- coding: utf-8 -*- | ||
2 | -# Generated by Django 1.10 on 2016-10-02 00:17 | ||
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='course', | ||
38 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course'), | ||
39 | - ), | ||
40 | - migrations.AddField( | ||
41 | - model_name='subject', | ||
42 | - name='professors', | ||
43 | - field=models.ManyToManyField(related_name='subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | ||
44 | - ), | ||
45 | - migrations.AddField( | ||
46 | - model_name='material', | ||
47 | - name='students', | ||
48 | - field=models.ManyToManyField(related_name='materials', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | ||
49 | - ), | ||
50 | - migrations.AddField( | ||
51 | - model_name='material', | ||
52 | - name='topic', | ||
53 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'), | ||
54 | - ), | ||
55 | - migrations.AddField( | ||
56 | - model_name='course', | ||
57 | - name='category', | ||
58 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Category', verbose_name='Category'), | ||
59 | - ), | ||
60 | - migrations.AddField( | ||
61 | - model_name='course', | ||
62 | - name='professors', | ||
63 | - field=models.ManyToManyField(related_name='courses_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | ||
64 | - ), | ||
65 | - migrations.AddField( | ||
66 | - model_name='course', | ||
67 | - name='students', | ||
68 | - field=models.ManyToManyField(related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | ||
69 | - ), | ||
70 | - migrations.AddField( | ||
71 | - model_name='activity', | ||
72 | - name='students', | ||
73 | - field=models.ManyToManyField(related_name='activities', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | ||
74 | - ), | ||
75 | - migrations.AddField( | ||
76 | - model_name='activity', | ||
77 | - name='topic', | ||
78 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'), | ||
79 | - ), | ||
80 | - ] |
courses/migrations/0003_activityfile.py
@@ -1,30 +0,0 @@ | @@ -1,30 +0,0 @@ | ||
1 | -# -*- coding: utf-8 -*- | ||
2 | -# Generated by Django 1.10 on 2016-10-03 16:10 | ||
3 | -from __future__ import unicode_literals | ||
4 | - | ||
5 | -from django.db import migrations, models | ||
6 | -import django.db.models.deletion | ||
7 | -import s3direct.fields | ||
8 | - | ||
9 | - | ||
10 | -class Migration(migrations.Migration): | ||
11 | - | ||
12 | - dependencies = [ | ||
13 | - ('courses', '0002_auto_20161001_2117'), | ||
14 | - ] | ||
15 | - | ||
16 | - operations = [ | ||
17 | - migrations.CreateModel( | ||
18 | - name='ActivityFile', | ||
19 | - fields=[ | ||
20 | - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
21 | - ('pdf', s3direct.fields.S3DirectField()), | ||
22 | - ('name', models.CharField(max_length=100)), | ||
23 | - ('diet', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='courses.Activity')), | ||
24 | - ], | ||
25 | - options={ | ||
26 | - 'verbose_name_plural': 'Activitys Files', | ||
27 | - 'verbose_name': 'Activity File', | ||
28 | - }, | ||
29 | - ), | ||
30 | - ] |
courses/templates/course/index.html
@@ -62,14 +62,14 @@ | @@ -62,14 +62,14 @@ | ||
62 | <div class="panel-group ui-accordion ui-widget ui-helper-reset ui-sortable" id="accordion" role="tablist" aria-multiselectable="false"> | 62 | <div class="panel-group ui-accordion ui-widget ui-helper-reset ui-sortable" id="accordion" role="tablist" aria-multiselectable="false"> |
63 | <div class="group"> | 63 | <div class="group"> |
64 | <div class="panel panel-info"> | 64 | <div class="panel panel-info"> |
65 | - <div class="panel-heading headingOne ui-sortable-handle" role="tab"> | 65 | + <div class="panel-heading" role="tab"> |
66 | <div class="row"> | 66 | <div class="row"> |
67 | - <div class="col-xs-9 col-md-10 titleTopic"> | 67 | + <div class="col-xs-9 col-md-9 titleTopic"> |
68 | <a role="button" data-toggle="collapse" data-parent="#accordion" href=".collapseOne" aria-expanded="false" aria-controls="collapseOne" class="collapsed"> | 68 | <a role="button" data-toggle="collapse" data-parent="#accordion" href=".collapseOne" aria-expanded="false" aria-controls="collapseOne" class="collapsed"> |
69 | - <h4>{{course.name}}</h4> | 69 | + <h4 style="color:white">{{course.name}}</h4> |
70 | </a> | 70 | </a> |
71 | </div> | 71 | </div> |
72 | - <div class="col-xs-4 col-md-2" id="divMoreActions"> | 72 | + <div class="col-xs-4 col-md-3" id="divMoreActions"> |
73 | <div class="btn-group"> | 73 | <div class="btn-group"> |
74 | <button type="button" class="btn btn-default btn-sm eye" data-toggle="tooltip" data-placement="bottom" title="Visible"> | 74 | <button type="button" class="btn btn-default btn-sm eye" data-toggle="tooltip" data-placement="bottom" title="Visible"> |
75 | <i class="fa fa-eye fa-2x" aria-hidden="true"></i> | 75 | <i class="fa fa-eye fa-2x" aria-hidden="true"></i> |
@@ -81,7 +81,6 @@ | @@ -81,7 +81,6 @@ | ||
81 | <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> | 81 | <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> |
82 | </button> | 82 | </button> |
83 | <ul class="dropdown-menu" aria-labelledby="moreActions"> | 83 | <ul class="dropdown-menu" aria-labelledby="moreActions"> |
84 | - <li><a href="{% url 'course:view' course.slug %}"><i class="fa fa-angle-double-right fa-fw" aria-hidden="true"></i> Access</a></li> | ||
85 | <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal4"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i> Replicate</a></li> | 84 | <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal4"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i> Replicate</a></li> |
86 | <li><a href="javascript:void(0)" data-toggle="modal" data-target="#removeCourse"><i class="fa fa-trash fa-fw" aria-hidden="true"></i> Remove</a></li> | 85 | <li><a href="javascript:void(0)" data-toggle="modal" data-target="#removeCourse"><i class="fa fa-trash fa-fw" aria-hidden="true"></i> Remove</a></li> |
87 | </ul> | 86 | </ul> |
@@ -100,7 +99,7 @@ | @@ -100,7 +99,7 @@ | ||
100 | {{course.description}} | 99 | {{course.description}} |
101 | </i> | 100 | </i> |
102 | </p> | 101 | </p> |
103 | - | 102 | + <a href="{% url 'course:view' course.slug %}" class="btn btn-raised btn-default center-block">{% trans 'View Course' %}<div class="ripple-container"></div></a> |
104 | </div> | 103 | </div> |
105 | </div> | 104 | </div> |
106 | </div> | 105 | </div> |
courses/templates/course/view.html
@@ -206,7 +206,6 @@ | @@ -206,7 +206,6 @@ | ||
206 | <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> | 206 | <i class="fa fa-ellipsis-v fa-2x" aria-hidden="true"></i> |
207 | </button> | 207 | </button> |
208 | <ul class="dropdown-menu" aria-labelledby="moreActions"> | 208 | <ul class="dropdown-menu" aria-labelledby="moreActions"> |
209 | - <li><a href="{% url 'course:view_subject' subject.slug %}"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i> Access</a></li> | ||
210 | <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal3"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i> Replicate</a></li> | 209 | <li><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal3"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i> Replicate</a></li> |
211 | <li><a href="javascript:void(0)" data-toggle="modal" data-target="#removeSubject2"><i class="fa fa-trash fa-fw" aria-hidden="true"></i> Remove</a></li> | 210 | <li><a href="javascript:void(0)" data-toggle="modal" data-target="#removeSubject2"><i class="fa fa-trash fa-fw" aria-hidden="true"></i> Remove</a></li> |
212 | </ul> | 211 | </ul> |
@@ -231,6 +230,7 @@ | @@ -231,6 +230,7 @@ | ||
231 | <p><b>{% trans "End" %}: </b>{{subject.end_date}}</p> | 230 | <p><b>{% trans "End" %}: </b>{{subject.end_date}}</p> |
232 | </div> | 231 | </div> |
233 | </div> | 232 | </div> |
233 | + <a href="{% url 'course:view_subject' subject.slug %}" class="btn btn-raised btn-default center-block">{% trans 'View Subject' %}<div class="ripple-container"></div></a> | ||
234 | </div> | 234 | </div> |
235 | </div> | 235 | </div> |
236 | {% endfor %} | 236 | {% endfor %} |
forum/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-02 00:17 | 2 | +# Generated by Django 1.10 on 2016-10-05 02:05 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | +from django.conf import settings | ||
5 | from django.db import migrations, models | 6 | from django.db import migrations, models |
6 | import django.db.models.deletion | 7 | import django.db.models.deletion |
7 | 8 | ||
@@ -12,6 +13,7 @@ class Migration(migrations.Migration): | @@ -12,6 +13,7 @@ class Migration(migrations.Migration): | ||
12 | 13 | ||
13 | dependencies = [ | 14 | dependencies = [ |
14 | ('courses', '0001_initial'), | 15 | ('courses', '0001_initial'), |
16 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
15 | ] | 17 | ] |
16 | 18 | ||
17 | operations = [ | 19 | operations = [ |
@@ -24,8 +26,8 @@ class Migration(migrations.Migration): | @@ -24,8 +26,8 @@ class Migration(migrations.Migration): | ||
24 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Create Date')), | 26 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Create Date')), |
25 | ], | 27 | ], |
26 | options={ | 28 | options={ |
27 | - 'verbose_name': 'Forum', | ||
28 | 'verbose_name_plural': 'Foruns', | 29 | 'verbose_name_plural': 'Foruns', |
30 | + 'verbose_name': 'Forum', | ||
29 | }, | 31 | }, |
30 | bases=('courses.activity',), | 32 | bases=('courses.activity',), |
31 | ), | 33 | ), |
@@ -36,10 +38,12 @@ class Migration(migrations.Migration): | @@ -36,10 +38,12 @@ class Migration(migrations.Migration): | ||
36 | ('message', models.TextField(verbose_name='Post message')), | 38 | ('message', models.TextField(verbose_name='Post message')), |
37 | ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), | 39 | ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), |
38 | ('post_date', models.DateTimeField(auto_now_add=True, verbose_name='Post Date')), | 40 | ('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')), | ||
39 | ], | 43 | ], |
40 | options={ | 44 | options={ |
41 | - 'verbose_name': 'Post', | ||
42 | 'verbose_name_plural': 'Posts', | 45 | 'verbose_name_plural': 'Posts', |
46 | + 'verbose_name': 'Post', | ||
43 | }, | 47 | }, |
44 | ), | 48 | ), |
45 | migrations.CreateModel( | 49 | migrations.CreateModel( |
@@ -50,10 +54,11 @@ class Migration(migrations.Migration): | @@ -50,10 +54,11 @@ class Migration(migrations.Migration): | ||
50 | ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), | 54 | ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), |
51 | ('answer_date', models.DateTimeField(auto_now_add=True, verbose_name='Answer Date')), | 55 | ('answer_date', models.DateTimeField(auto_now_add=True, verbose_name='Answer Date')), |
52 | ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Post', verbose_name='Post')), | 56 | ('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')), | ||
53 | ], | 58 | ], |
54 | options={ | 59 | options={ |
55 | - 'verbose_name': 'Post Answer', | ||
56 | 'verbose_name_plural': 'Post Answers', | 60 | 'verbose_name_plural': 'Post Answers', |
61 | + 'verbose_name': 'Post Answer', | ||
57 | }, | 62 | }, |
58 | ), | 63 | ), |
59 | ] | 64 | ] |
forum/migrations/0002_auto_20161001_2117.py
@@ -1,35 +0,0 @@ | @@ -1,35 +0,0 @@ | ||
1 | -# -*- coding: utf-8 -*- | ||
2 | -# Generated by Django 1.10 on 2016-10-02 00:17 | ||
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 | - ] |
forum/static/js/forum.js
1 | +/* | ||
2 | +* | ||
3 | +* Function to get a cookie stored on browser | ||
4 | +* | ||
5 | +*/ | ||
1 | function getCookie(name) { | 6 | function getCookie(name) { |
2 | var cookieValue = null; | 7 | var cookieValue = null; |
3 | if (document.cookie && document.cookie !== '') { | 8 | if (document.cookie && document.cookie !== '') { |
@@ -16,6 +21,31 @@ function getCookie(name) { | @@ -16,6 +21,31 @@ function getCookie(name) { | ||
16 | 21 | ||
17 | /* | 22 | /* |
18 | * | 23 | * |
24 | +* Defining action of the form to make a post in forum | ||
25 | +* | ||
26 | +*/ | ||
27 | +$(document).ready(function (){ | ||
28 | + var frm = $('#form_post'); | ||
29 | + frm.submit(function () { | ||
30 | + $.ajax({ | ||
31 | + type: frm.attr('method'), | ||
32 | + url: frm.attr('action'), | ||
33 | + data: frm.serialize(), | ||
34 | + success: function (data) { | ||
35 | + $("#posts_list").append(data); | ||
36 | + frm[0].reset(); | ||
37 | + }, | ||
38 | + error: function(data) { | ||
39 | + console.log(frm.serialize()); | ||
40 | + console.log('Error'); | ||
41 | + } | ||
42 | + }); | ||
43 | + return false; | ||
44 | + }); | ||
45 | +}); | ||
46 | + | ||
47 | +/* | ||
48 | +* | ||
19 | * Function to load create forum's form and set the submit function | 49 | * Function to load create forum's form and set the submit function |
20 | * | 50 | * |
21 | */ | 51 | */ |
@@ -59,40 +89,10 @@ function createForum(url, topic) { | @@ -59,40 +89,10 @@ function createForum(url, topic) { | ||
59 | 89 | ||
60 | /* | 90 | /* |
61 | * | 91 | * |
62 | -* Function to load forum to modal | 92 | +* Function to delete a forum |
63 | * | 93 | * |
64 | */ | 94 | */ |
65 | -function showForum(url, forum_id) { | ||
66 | - $.ajax({ | ||
67 | - url: url, | ||
68 | - data: {'forum_id': forum_id}, | ||
69 | - success: function(data) { | ||
70 | - $(".forum_topics").html(data); | ||
71 | - | ||
72 | - var frm = $('#form_post'); | ||
73 | - frm.submit(function () { | ||
74 | - $.ajax({ | ||
75 | - type: frm.attr('method'), | ||
76 | - url: frm.attr('action'), | ||
77 | - data: frm.serialize(), | ||
78 | - success: function (data) { | ||
79 | - $("#posts_list").append(data); | ||
80 | - frm[0].reset(); | ||
81 | - }, | ||
82 | - error: function(data) { | ||
83 | - console.log(frm.serialize()); | ||
84 | - console.log('Error'); | ||
85 | - } | ||
86 | - }); | ||
87 | - return false; | ||
88 | - }); | ||
89 | - } | ||
90 | - }); | ||
91 | - | ||
92 | - $('#forumModal').modal(); | ||
93 | -} | ||
94 | - | ||
95 | -function delete_forum(url, forum, message) { | 95 | +function delete_forum(url, forum, message, return_url) { |
96 | alertify.confirm(message, function(){ | 96 | alertify.confirm(message, function(){ |
97 | var csrftoken = getCookie('csrftoken'); | 97 | var csrftoken = getCookie('csrftoken'); |
98 | 98 | ||
@@ -103,8 +103,9 @@ function delete_forum(url, forum, message) { | @@ -103,8 +103,9 @@ function delete_forum(url, forum, message) { | ||
103 | }, | 103 | }, |
104 | url: url, | 104 | url: url, |
105 | success: function(data) { | 105 | success: function(data) { |
106 | - $("#forum_"+forum).remove(); | ||
107 | - $('#forumModal').modal('hide'); | 106 | + alertify.alert('Amadeus', data, function(){ |
107 | + window.location.href = return_url; | ||
108 | + }); | ||
108 | } | 109 | } |
109 | }); | 110 | }); |
110 | }); | 111 | }); |
forum/templates/forum/forum_view.html
@@ -42,7 +42,7 @@ | @@ -42,7 +42,7 @@ | ||
42 | <div class="panel-body"> | 42 | <div class="panel-body"> |
43 | <ul class="nav nav-pills nav-stacked"> | 43 | <ul class="nav nav-pills nav-stacked"> |
44 | <li><a href="javascript:edit_forum('{% url 'course:forum:index' %}', '{{ forum.id }}')">{% trans 'Edit' %}</a></li> | 44 | <li><a href="javascript:edit_forum('{% url 'course:forum:index' %}', '{{ forum.id }}')">{% trans 'Edit' %}</a></li> |
45 | - <li><a href="javascript:delete_forum('{% url 'course:forum:delete' forum.id %}', '{{ forum.id }}', '{% trans "Are you sure you want to delete this forum?" %}')">{% trans 'Delete' %}</a></li> | 45 | + <li><a href="javascript:delete_forum('{% url 'course:forum:delete' forum.id %}', '{{ forum.id }}', '{% trans "Are you sure you want to delete this forum?" %}', '{% url 'course:view_subject' forum.topic.subject.slug %}')">{% trans 'Delete' %}</a></li> |
46 | </ul> | 46 | </ul> |
47 | </div> | 47 | </div> |
48 | </div> | 48 | </div> |
@@ -59,7 +59,45 @@ | @@ -59,7 +59,45 @@ | ||
59 | <h4><b>{% trans 'Opened in' %}:</b> {{ forum.create_date }}</h4> | 59 | <h4><b>{% trans 'Opened in' %}:</b> {{ forum.create_date }}</h4> |
60 | </div> | 60 | </div> |
61 | </div> | 61 | </div> |
62 | - | 62 | + <div class="form_post_block"> |
63 | + <hr /> | ||
64 | + <form id="form_post" method="post" action="{% url 'course:forum:create_post' %}" enctype="multipart/form-data"> | ||
65 | + {% csrf_token %} | ||
66 | + {% for field in form %} | ||
67 | + {% if field.field.widget.input_type == 'hidden' %} | ||
68 | + {% render_field field class='form-control' value=forum.id %} | ||
69 | + {% else %} | ||
70 | + <div class="form-group {% if form.has_error %} has-error {% endif %} is-fileinput"> | ||
71 | + <div class="input-group"> | ||
72 | + {% render_field field class='form-control' placeholder="Post a message" %} | ||
73 | + <span class="help-block">{{ field.help_text }}</span> | ||
74 | + {% if field.errors %} | ||
75 | + <div class="row"> | ||
76 | + <br /> | ||
77 | + <div class="alert alert-danger alert-dismissible" role="alert"> | ||
78 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | ||
79 | + <span aria-hidden="true">×</span> | ||
80 | + </button> | ||
81 | + <ul> | ||
82 | + {% for error in field.errors %} | ||
83 | + <li>{{ error }}</li> | ||
84 | + {% endfor %} | ||
85 | + </ul> | ||
86 | + </div> | ||
87 | + </div> | ||
88 | + {% endif %} | ||
89 | + <span class="input-group-btn"> | ||
90 | + <button type="submit" class="btn btn-fab btn-fab-mini"> | ||
91 | + <i class="material-icons">send</i> | ||
92 | + </button> | ||
93 | + </span> | ||
94 | + </div> | ||
95 | + </div> | ||
96 | + {% endif %} | ||
97 | + {% endfor %} | ||
98 | + </form> | ||
99 | + <hr /> | ||
100 | + </div> | ||
63 | <div id="posts_list"> | 101 | <div id="posts_list"> |
64 | {% list_posts request forum %} | 102 | {% list_posts request forum %} |
65 | </div> | 103 | </div> |
forum/urls.py
@@ -5,7 +5,6 @@ from . import views | @@ -5,7 +5,6 @@ from . import views | ||
5 | 5 | ||
6 | urlpatterns = [ | 6 | urlpatterns = [ |
7 | url(r'^$', views.ForumIndex.as_view(), name='index'), | 7 | url(r'^$', views.ForumIndex.as_view(), name='index'), |
8 | - url(r'^(?P<slug>[\w_-]+)/$', views.ForumDetailView.as_view(), name='view'), | ||
9 | url(r'^create/$', views.CreateForumView.as_view(), name='create'), | 8 | url(r'^create/$', views.CreateForumView.as_view(), name='create'), |
10 | url(r'^delete/(?P<pk>[\w_-]+)/$', views.ForumDeleteView.as_view(), name='delete'), | 9 | url(r'^delete/(?P<pk>[\w_-]+)/$', views.ForumDeleteView.as_view(), name='delete'), |
11 | url(r'^render_forum/([\w_-]+)/$', views.render_forum, name='render_forum'), | 10 | url(r'^render_forum/([\w_-]+)/$', views.render_forum, name='render_forum'), |
@@ -17,4 +16,5 @@ urlpatterns = [ | @@ -17,4 +16,5 @@ urlpatterns = [ | ||
17 | url(r'^post_deleted/$', views.post_deleted, name='deleted_post'), | 16 | url(r'^post_deleted/$', views.post_deleted, name='deleted_post'), |
18 | url(r'^post_answers/$', views.PostAnswerIndex.as_view(), name='post_answers'), | 17 | url(r'^post_answers/$', views.PostAnswerIndex.as_view(), name='post_answers'), |
19 | url(r'^reply_post/$', views.CreatePostAnswerView.as_view(), name='reply_post'), | 18 | url(r'^reply_post/$', views.CreatePostAnswerView.as_view(), name='reply_post'), |
19 | + url(r'^(?P<slug>[\w_-]+)/$', views.ForumDetailView.as_view(), name='view'), | ||
20 | ] | 20 | ] |
forum/views.py
@@ -74,6 +74,7 @@ class ForumDetailView(LoginRequiredMixin, generic.DetailView): | @@ -74,6 +74,7 @@ class ForumDetailView(LoginRequiredMixin, generic.DetailView): | ||
74 | context = super(ForumDetailView, self).get_context_data(**kwargs) | 74 | context = super(ForumDetailView, self).get_context_data(**kwargs) |
75 | forum = get_object_or_404(Forum, slug = self.kwargs.get('slug')) | 75 | forum = get_object_or_404(Forum, slug = self.kwargs.get('slug')) |
76 | 76 | ||
77 | + context['form'] = PostForm() | ||
77 | context['forum'] = forum | 78 | context['forum'] = forum |
78 | context['title'] = forum.name | 79 | context['title'] = forum.name |
79 | 80 | ||
@@ -145,6 +146,8 @@ class PostAnswerIndex(LoginRequiredMixin, generic.ListView): | @@ -145,6 +146,8 @@ class PostAnswerIndex(LoginRequiredMixin, generic.ListView): | ||
145 | return context | 146 | return context |
146 | 147 | ||
147 | class CreatePostAnswerView(LoginRequiredMixin, generic.edit.CreateView): | 148 | class CreatePostAnswerView(LoginRequiredMixin, generic.edit.CreateView): |
149 | + login_url = reverse_lazy("core:home") | ||
150 | + redirect_field_name = 'next' | ||
148 | 151 | ||
149 | template_name = 'post_answers/post_answer_form.html' | 152 | template_name = 'post_answers/post_answer_form.html' |
150 | form_class = PostAnswerForm | 153 | form_class = PostAnswerForm |
@@ -0,0 +1,15 @@ | @@ -0,0 +1,15 @@ | ||
1 | +from django.db import models | ||
2 | +from courses.models import Material | ||
3 | +# Create your models here. | ||
4 | +class Link(Material,models.Model): | ||
5 | + name = models.CharField(max_lenght = 100) | ||
6 | + link = models.UrlField() | ||
7 | + description = models.CharField(max_lenght = 200) | ||
8 | + class Meta: | ||
9 | + verbose_name = 'Link' | ||
10 | + verbose_name_plural = "Links" | ||
11 | + def __str__(self): | ||
12 | + return str(self.name) | ||
13 | + | ||
14 | + | ||
15 | + |
poll/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-02 00:17 | 2 | +# Generated by Django 1.10 on 2016-10-05 02:05 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | from django.db import migrations, models | 5 | from django.db import migrations, models |
@@ -24,8 +24,8 @@ class Migration(migrations.Migration): | @@ -24,8 +24,8 @@ class Migration(migrations.Migration): | ||
24 | ], | 24 | ], |
25 | options={ | 25 | options={ |
26 | 'ordering': ('order',), | 26 | 'ordering': ('order',), |
27 | - 'verbose_name': 'Answer', | ||
28 | 'verbose_name_plural': 'Answers', | 27 | 'verbose_name_plural': 'Answers', |
28 | + 'verbose_name': 'Answer', | ||
29 | }, | 29 | }, |
30 | ), | 30 | ), |
31 | migrations.CreateModel( | 31 | migrations.CreateModel( |
@@ -34,8 +34,8 @@ class Migration(migrations.Migration): | @@ -34,8 +34,8 @@ class Migration(migrations.Migration): | ||
34 | ('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')), | 34 | ('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')), |
35 | ], | 35 | ], |
36 | options={ | 36 | options={ |
37 | - 'verbose_name': 'Poll', | ||
38 | 'verbose_name_plural': 'Polls', | 37 | 'verbose_name_plural': 'Polls', |
38 | + 'verbose_name': 'Poll', | ||
39 | }, | 39 | }, |
40 | bases=('courses.activity',), | 40 | bases=('courses.activity',), |
41 | ), | 41 | ), |
users/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-10-02 00:17 | 2 | +# Generated by Django 1.10 on 2016-10-03 19:10 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | import django.contrib.auth.models | 5 | import django.contrib.auth.models |
@@ -42,8 +42,8 @@ class Migration(migrations.Migration): | @@ -42,8 +42,8 @@ class Migration(migrations.Migration): | ||
42 | ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), | 42 | ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), |
43 | ], | 43 | ], |
44 | options={ | 44 | options={ |
45 | - 'verbose_name': 'User', | ||
46 | 'verbose_name_plural': 'Users', | 45 | 'verbose_name_plural': 'Users', |
46 | + 'verbose_name': 'User', | ||
47 | }, | 47 | }, |
48 | managers=[ | 48 | managers=[ |
49 | ('objects', django.contrib.auth.models.UserManager()), | 49 | ('objects', django.contrib.auth.models.UserManager()), |