Commit b869409bd7972f90e6cd67f9456afc8a04b9fce3
Exists in
master
and in
5 other branches
Merge branch 'dev' of https://github.com/amadeusproject/amadeuslms into dev
Showing
52 changed files
with
939 additions
and
555 deletions
Show diff stats
amadeus/urls.py
| ... | ... | @@ -23,6 +23,7 @@ urlpatterns = [ |
| 23 | 23 | url(r'^home/', include('app.urls', namespace = 'app')), |
| 24 | 24 | url(r'^courses/', include('courses.urls', namespace = 'course')), |
| 25 | 25 | url(r'^users/', include('users.urls', namespace = 'users')), |
| 26 | + url(r'^exercise/', include('exercise.urls', namespace = 'exercise')), | |
| 26 | 27 | url(r'^admin/', admin.site.urls), |
| 27 | 28 | url(r'^', include('core.urls', namespace = 'core')), |
| 28 | 29 | #API | ... | ... |
app/migrations/0001_initial.py
| 1 | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-16 13:57 | |
| 2 | + | |
| 3 | +# Generated by Django 1.10 on 2016-11-15 22:36 | |
| 3 | 4 | from __future__ import unicode_literals |
| 4 | 5 | |
| 5 | 6 | from django.db import migrations, models |
| ... | ... | @@ -23,11 +24,11 @@ class Migration(migrations.Migration): |
| 23 | 24 | ('username', models.CharField(max_length=30, verbose_name='Email host username')), |
| 24 | 25 | ('password', models.CharField(blank=True, max_length=30, verbose_name='Email host password')), |
| 25 | 26 | ('safe_conection', models.IntegerField(choices=[(0, 'No'), (1, 'TLS, if available'), (2, 'TLS'), (3, 'SSL')], default=0, verbose_name='Use safe conection')), |
| 26 | - ('default_from_email', models.EmailField(max_length=254, verbose_name='Default from email')), | |
| 27 | + ('default_from_email', models.EmailField(blank=True, max_length=254, verbose_name='Default from email')), | |
| 27 | 28 | ], |
| 28 | 29 | options={ |
| 29 | - 'verbose_name_plural': 'Amadeus SMTP settings', | |
| 30 | 30 | 'verbose_name': 'Amadeus SMTP setting', |
| 31 | + 'verbose_name_plural': 'Amadeus SMTP settings', | |
| 31 | 32 | }, |
| 32 | 33 | ), |
| 33 | 34 | ] | ... | ... |
| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.10 on 2016-11-15 23:54 | |
| 3 | +from __future__ import unicode_literals | |
| 4 | + | |
| 5 | +from django.db import migrations, models | |
| 6 | + | |
| 7 | + | |
| 8 | +class Migration(migrations.Migration): | |
| 9 | + | |
| 10 | + dependencies = [ | |
| 11 | + ('app', '0001_initial'), | |
| 12 | + ] | |
| 13 | + | |
| 14 | + operations = [ | |
| 15 | + migrations.AlterField( | |
| 16 | + model_name='emailbackend', | |
| 17 | + name='default_from_email', | |
| 18 | + field=models.EmailField(max_length=254, verbose_name='Default from email'), | |
| 19 | + ), | |
| 20 | + ] | ... | ... |
core/migrations/0001_initial.py
| 1 | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-16 13:57 | |
| 2 | + | |
| 3 | +# Generated by Django 1.10 on 2016-11-15 22:36 | |
| 3 | 4 | from __future__ import unicode_literals |
| 4 | 5 | |
| 5 | 6 | import autoslug.fields |
| ... | ... | @@ -25,8 +26,8 @@ class Migration(migrations.Migration): |
| 25 | 26 | ('created_date', models.DateTimeField(auto_now_add=True, verbose_name='Created Date')), |
| 26 | 27 | ], |
| 27 | 28 | options={ |
| 28 | - 'verbose_name_plural': 'Actions', | |
| 29 | 29 | 'verbose_name': 'Action', |
| 30 | + 'verbose_name_plural': 'Actions', | |
| 30 | 31 | }, |
| 31 | 32 | ), |
| 32 | 33 | migrations.CreateModel( |
| ... | ... | @@ -35,8 +36,8 @@ class Migration(migrations.Migration): |
| 35 | 36 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
| 36 | 37 | ], |
| 37 | 38 | options={ |
| 38 | - 'verbose_name_plural': 'Action_Resources', | |
| 39 | 39 | 'verbose_name': 'Action_Resource', |
| 40 | + 'verbose_name_plural': 'Action_Resources', | |
| 40 | 41 | }, |
| 41 | 42 | ), |
| 42 | 43 | migrations.CreateModel( |
| ... | ... | @@ -48,8 +49,8 @@ class Migration(migrations.Migration): |
| 48 | 49 | ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), |
| 49 | 50 | ], |
| 50 | 51 | options={ |
| 51 | - 'verbose_name_plural': 'Logs', | |
| 52 | 52 | 'verbose_name': 'Log', |
| 53 | + 'verbose_name_plural': 'Logs', | |
| 53 | 54 | }, |
| 54 | 55 | ), |
| 55 | 56 | migrations.CreateModel( |
| ... | ... | @@ -60,8 +61,8 @@ class Migration(migrations.Migration): |
| 60 | 61 | ('icon', models.CharField(max_length=50, unique=True, verbose_name='Icon')), |
| 61 | 62 | ], |
| 62 | 63 | options={ |
| 63 | - 'verbose_name_plural': 'Amadeus Mime Types', | |
| 64 | 64 | 'verbose_name': 'Amadeus Mime Type', |
| 65 | + 'verbose_name_plural': 'Amadeus Mime Types', | |
| 65 | 66 | }, |
| 66 | 67 | ), |
| 67 | 68 | migrations.CreateModel( |
| ... | ... | @@ -74,8 +75,8 @@ class Migration(migrations.Migration): |
| 74 | 75 | ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')), |
| 75 | 76 | ], |
| 76 | 77 | options={ |
| 77 | - 'verbose_name_plural': 'Notifications', | |
| 78 | 78 | 'verbose_name': 'Notification', |
| 79 | + 'verbose_name_plural': 'Notifications', | |
| 79 | 80 | }, |
| 80 | 81 | ), |
| 81 | 82 | migrations.CreateModel( |
| ... | ... | @@ -88,8 +89,8 @@ class Migration(migrations.Migration): |
| 88 | 89 | ('url', models.CharField(default='', max_length=100, verbose_name='URL')), |
| 89 | 90 | ], |
| 90 | 91 | options={ |
| 91 | - 'verbose_name_plural': 'Resources', | |
| 92 | 92 | 'verbose_name': 'Resource', |
| 93 | + 'verbose_name_plural': 'Resources', | |
| 93 | 94 | }, |
| 94 | 95 | ), |
| 95 | 96 | ] | ... | ... |
| ... | ... | @@ -0,0 +1,50 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 | |
| 3 | +from __future__ import unicode_literals | |
| 4 | + | |
| 5 | +from django.conf import settings | |
| 6 | +from django.db import migrations, models | |
| 7 | +import django.db.models.deletion | |
| 8 | + | |
| 9 | + | |
| 10 | +class Migration(migrations.Migration): | |
| 11 | + | |
| 12 | + initial = True | |
| 13 | + | |
| 14 | + dependencies = [ | |
| 15 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
| 16 | + ('core', '0001_initial'), | |
| 17 | + ] | |
| 18 | + | |
| 19 | + operations = [ | |
| 20 | + migrations.AddField( | |
| 21 | + model_name='notification', | |
| 22 | + name='actor', | |
| 23 | + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notification_Performer', to=settings.AUTH_USER_MODEL, verbose_name='Performer'), | |
| 24 | + ), | |
| 25 | + migrations.AddField( | |
| 26 | + model_name='notification', | |
| 27 | + name='user', | |
| 28 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User'), | |
| 29 | + ), | |
| 30 | + migrations.AddField( | |
| 31 | + model_name='log', | |
| 32 | + name='action_resource', | |
| 33 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource'), | |
| 34 | + ), | |
| 35 | + migrations.AddField( | |
| 36 | + model_name='log', | |
| 37 | + name='user', | |
| 38 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor'), | |
| 39 | + ), | |
| 40 | + migrations.AddField( | |
| 41 | + model_name='action_resource', | |
| 42 | + name='action', | |
| 43 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied'), | |
| 44 | + ), | |
| 45 | + migrations.AddField( | |
| 46 | + model_name='action_resource', | |
| 47 | + name='resource', | |
| 48 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Resource', verbose_name='Resource'), | |
| 49 | + ), | |
| 50 | + ] | ... | ... |
core/migrations/0002_auto_20161116_1057.py
| ... | ... | @@ -1,50 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -# Generated by Django 1.10 on 2016-11-16 13:57 | |
| 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='Performer'), | |
| 24 | - ), | |
| 25 | - migrations.AddField( | |
| 26 | - model_name='notification', | |
| 27 | - name='user', | |
| 28 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User'), | |
| 29 | - ), | |
| 30 | - migrations.AddField( | |
| 31 | - model_name='log', | |
| 32 | - name='action_resource', | |
| 33 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource'), | |
| 34 | - ), | |
| 35 | - migrations.AddField( | |
| 36 | - model_name='log', | |
| 37 | - name='user', | |
| 38 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor'), | |
| 39 | - ), | |
| 40 | - migrations.AddField( | |
| 41 | - model_name='action_resource', | |
| 42 | - name='action', | |
| 43 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied'), | |
| 44 | - ), | |
| 45 | - migrations.AddField( | |
| 46 | - model_name='action_resource', | |
| 47 | - name='resource', | |
| 48 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Resource', verbose_name='Resource'), | |
| 49 | - ), | |
| 50 | - ] |
| ... | ... | @@ -0,0 +1,50 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
| 3 | +from __future__ import unicode_literals | |
| 4 | + | |
| 5 | +from django.conf import settings | |
| 6 | +from django.db import migrations, models | |
| 7 | +import django.db.models.deletion | |
| 8 | + | |
| 9 | + | |
| 10 | +class Migration(migrations.Migration): | |
| 11 | + | |
| 12 | + initial = True | |
| 13 | + | |
| 14 | + dependencies = [ | |
| 15 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
| 16 | + ('core', '0001_initial'), | |
| 17 | + ] | |
| 18 | + | |
| 19 | + operations = [ | |
| 20 | + migrations.AddField( | |
| 21 | + model_name='notification', | |
| 22 | + name='actor', | |
| 23 | + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notification_Performer', to=settings.AUTH_USER_MODEL, verbose_name='Performer'), | |
| 24 | + ), | |
| 25 | + migrations.AddField( | |
| 26 | + model_name='notification', | |
| 27 | + name='user', | |
| 28 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User'), | |
| 29 | + ), | |
| 30 | + migrations.AddField( | |
| 31 | + model_name='log', | |
| 32 | + name='action_resource', | |
| 33 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource'), | |
| 34 | + ), | |
| 35 | + migrations.AddField( | |
| 36 | + model_name='log', | |
| 37 | + name='user', | |
| 38 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor'), | |
| 39 | + ), | |
| 40 | + migrations.AddField( | |
| 41 | + model_name='action_resource', | |
| 42 | + name='action', | |
| 43 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied'), | |
| 44 | + ), | |
| 45 | + migrations.AddField( | |
| 46 | + model_name='action_resource', | |
| 47 | + name='resource', | |
| 48 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Resource', verbose_name='Resource'), | |
| 49 | + ), | |
| 50 | + ] | ... | ... |
courses/migrations/0001_initial.py
| 1 | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-16 13:57 | |
| 2 | + | |
| 3 | +# Generated by Django 1.10 on 2016-11-15 22:36 | |
| 3 | 4 | from __future__ import unicode_literals |
| 4 | 5 | |
| 5 | 6 | import autoslug.fields |
| ... | ... | @@ -34,8 +35,8 @@ class Migration(migrations.Migration): |
| 34 | 35 | ('name', models.CharField(max_length=100)), |
| 35 | 36 | ], |
| 36 | 37 | options={ |
| 37 | - 'verbose_name_plural': 'Activitys Files', | |
| 38 | 38 | 'verbose_name': 'Activity File', |
| 39 | + 'verbose_name_plural': 'Activitys Files', | |
| 39 | 40 | }, |
| 40 | 41 | ), |
| 41 | 42 | migrations.CreateModel( |
| ... | ... | @@ -47,8 +48,8 @@ class Migration(migrations.Migration): |
| 47 | 48 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), |
| 48 | 49 | ], |
| 49 | 50 | options={ |
| 50 | - 'verbose_name_plural': 'Categories', | |
| 51 | 51 | 'verbose_name': 'Category', |
| 52 | + 'verbose_name_plural': 'Categories', | |
| 52 | 53 | }, |
| 53 | 54 | ), |
| 54 | 55 | migrations.CreateModel( |
| ... | ... | @@ -68,9 +69,9 @@ class Migration(migrations.Migration): |
| 68 | 69 | ('public', models.BooleanField(default=False, verbose_name='Public')), |
| 69 | 70 | ], |
| 70 | 71 | options={ |
| 72 | + 'verbose_name': 'Course', | |
| 71 | 73 | 'verbose_name_plural': 'Courses', |
| 72 | 74 | 'ordering': ('create_date', 'name'), |
| 73 | - 'verbose_name': 'Course', | |
| 74 | 75 | }, |
| 75 | 76 | ), |
| 76 | 77 | migrations.CreateModel( |
| ... | ... | @@ -82,8 +83,8 @@ class Migration(migrations.Migration): |
| 82 | 83 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), |
| 83 | 84 | ], |
| 84 | 85 | options={ |
| 85 | - 'verbose_name_plural': 'Categories', | |
| 86 | 86 | 'verbose_name': 'Category', |
| 87 | + 'verbose_name_plural': 'Categories', | |
| 87 | 88 | }, |
| 88 | 89 | ), |
| 89 | 90 | migrations.CreateModel( |
| ... | ... | @@ -127,9 +128,9 @@ class Migration(migrations.Migration): |
| 127 | 128 | ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course')), |
| 128 | 129 | ], |
| 129 | 130 | options={ |
| 131 | + 'verbose_name': 'Subject', | |
| 130 | 132 | 'verbose_name_plural': 'Subjects', |
| 131 | 133 | 'ordering': ('create_date', 'name'), |
| 132 | - 'verbose_name': 'Subject', | |
| 133 | 134 | }, |
| 134 | 135 | ), |
| 135 | 136 | migrations.CreateModel( |
| ... | ... | @@ -142,8 +143,8 @@ class Migration(migrations.Migration): |
| 142 | 143 | ('subjects', models.ManyToManyField(to='courses.Subject')), |
| 143 | 144 | ], |
| 144 | 145 | options={ |
| 145 | - 'verbose_name_plural': 'subject categories', | |
| 146 | 146 | 'verbose_name': 'subject category', |
| 147 | + 'verbose_name_plural': 'subject categories', | |
| 147 | 148 | }, |
| 148 | 149 | ), |
| 149 | 150 | migrations.CreateModel( |
| ... | ... | @@ -159,9 +160,9 @@ class Migration(migrations.Migration): |
| 159 | 160 | ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject')), |
| 160 | 161 | ], |
| 161 | 162 | options={ |
| 163 | + 'verbose_name': 'Topic', | |
| 162 | 164 | 'verbose_name_plural': 'Topics', |
| 163 | 165 | 'ordering': ('create_date', 'name'), |
| 164 | - 'verbose_name': 'Topic', | |
| 165 | 166 | }, |
| 166 | 167 | ), |
| 167 | 168 | ] | ... | ... |
| ... | ... | @@ -0,0 +1,85 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 | |
| 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='subject', | |
| 22 | + name='professors', | |
| 23 | + field=models.ManyToManyField(related_name='professors_subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | |
| 24 | + ), | |
| 25 | + migrations.AddField( | |
| 26 | + model_name='subject', | |
| 27 | + name='students', | |
| 28 | + field=models.ManyToManyField(blank=True, related_name='subject_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
| 29 | + ), | |
| 30 | + migrations.AddField( | |
| 31 | + model_name='material', | |
| 32 | + name='students', | |
| 33 | + field=models.ManyToManyField(related_name='materials', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
| 34 | + ), | |
| 35 | + migrations.AddField( | |
| 36 | + model_name='material', | |
| 37 | + name='topic', | |
| 38 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'), | |
| 39 | + ), | |
| 40 | + migrations.AddField( | |
| 41 | + model_name='linkmaterial', | |
| 42 | + name='material', | |
| 43 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_link', to='courses.Material', verbose_name='Material'), | |
| 44 | + ), | |
| 45 | + migrations.AddField( | |
| 46 | + model_name='filematerial', | |
| 47 | + name='material', | |
| 48 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_file', to='courses.Material', verbose_name='Material'), | |
| 49 | + ), | |
| 50 | + migrations.AddField( | |
| 51 | + model_name='course', | |
| 52 | + name='category', | |
| 53 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_category', to='courses.CourseCategory', verbose_name='Category'), | |
| 54 | + ), | |
| 55 | + migrations.AddField( | |
| 56 | + model_name='course', | |
| 57 | + name='coordenator', | |
| 58 | + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='course_coordenator', to=settings.AUTH_USER_MODEL, verbose_name='Coordenator'), | |
| 59 | + ), | |
| 60 | + migrations.AddField( | |
| 61 | + model_name='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(blank=True, related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
| 69 | + ), | |
| 70 | + migrations.AddField( | |
| 71 | + model_name='activityfile', | |
| 72 | + name='diet', | |
| 73 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='courses.Activity'), | |
| 74 | + ), | |
| 75 | + migrations.AddField( | |
| 76 | + model_name='activity', | |
| 77 | + name='students', | |
| 78 | + field=models.ManyToManyField(related_name='activities', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
| 79 | + ), | |
| 80 | + migrations.AddField( | |
| 81 | + model_name='activity', | |
| 82 | + name='topic', | |
| 83 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'), | |
| 84 | + ), | |
| 85 | + ] | ... | ... |
courses/migrations/0002_auto_20161116_1057.py
| ... | ... | @@ -1,85 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -# Generated by Django 1.10 on 2016-11-16 13:57 | |
| 3 | -from __future__ import unicode_literals | |
| 4 | - | |
| 5 | -from django.conf import settings | |
| 6 | -from django.db import migrations, models | |
| 7 | -import django.db.models.deletion | |
| 8 | - | |
| 9 | - | |
| 10 | -class Migration(migrations.Migration): | |
| 11 | - | |
| 12 | - initial = True | |
| 13 | - | |
| 14 | - dependencies = [ | |
| 15 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
| 16 | - ('courses', '0001_initial'), | |
| 17 | - ] | |
| 18 | - | |
| 19 | - operations = [ | |
| 20 | - migrations.AddField( | |
| 21 | - model_name='subject', | |
| 22 | - name='professors', | |
| 23 | - field=models.ManyToManyField(related_name='professors_subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | |
| 24 | - ), | |
| 25 | - migrations.AddField( | |
| 26 | - model_name='subject', | |
| 27 | - name='students', | |
| 28 | - field=models.ManyToManyField(blank=True, related_name='subject_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
| 29 | - ), | |
| 30 | - migrations.AddField( | |
| 31 | - model_name='material', | |
| 32 | - name='students', | |
| 33 | - field=models.ManyToManyField(related_name='materials', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
| 34 | - ), | |
| 35 | - migrations.AddField( | |
| 36 | - model_name='material', | |
| 37 | - name='topic', | |
| 38 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'), | |
| 39 | - ), | |
| 40 | - migrations.AddField( | |
| 41 | - model_name='linkmaterial', | |
| 42 | - name='material', | |
| 43 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_link', to='courses.Material', verbose_name='Material'), | |
| 44 | - ), | |
| 45 | - migrations.AddField( | |
| 46 | - model_name='filematerial', | |
| 47 | - name='material', | |
| 48 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_file', to='courses.Material', verbose_name='Material'), | |
| 49 | - ), | |
| 50 | - migrations.AddField( | |
| 51 | - model_name='course', | |
| 52 | - name='category', | |
| 53 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_category', to='courses.CourseCategory', verbose_name='Category'), | |
| 54 | - ), | |
| 55 | - migrations.AddField( | |
| 56 | - model_name='course', | |
| 57 | - name='coordenator', | |
| 58 | - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='course_coordenator', to=settings.AUTH_USER_MODEL, verbose_name='Coordenator'), | |
| 59 | - ), | |
| 60 | - migrations.AddField( | |
| 61 | - model_name='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(blank=True, related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
| 69 | - ), | |
| 70 | - migrations.AddField( | |
| 71 | - model_name='activityfile', | |
| 72 | - name='diet', | |
| 73 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='courses.Activity'), | |
| 74 | - ), | |
| 75 | - migrations.AddField( | |
| 76 | - model_name='activity', | |
| 77 | - name='students', | |
| 78 | - field=models.ManyToManyField(related_name='activities', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
| 79 | - ), | |
| 80 | - migrations.AddField( | |
| 81 | - model_name='activity', | |
| 82 | - name='topic', | |
| 83 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'), | |
| 84 | - ), | |
| 85 | - ] |
| ... | ... | @@ -0,0 +1,75 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
| 3 | +from __future__ import unicode_literals | |
| 4 | + | |
| 5 | +from django.conf import settings | |
| 6 | +from django.db import migrations, models | |
| 7 | +import django.db.models.deletion | |
| 8 | + | |
| 9 | + | |
| 10 | +class Migration(migrations.Migration): | |
| 11 | + | |
| 12 | + initial = True | |
| 13 | + | |
| 14 | + dependencies = [ | |
| 15 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
| 16 | + ('courses', '0001_initial'), | |
| 17 | + ] | |
| 18 | + | |
| 19 | + operations = [ | |
| 20 | + migrations.AddField( | |
| 21 | + model_name='subject', | |
| 22 | + name='professors', | |
| 23 | + field=models.ManyToManyField(related_name='professors_subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | |
| 24 | + ), | |
| 25 | + migrations.AddField( | |
| 26 | + model_name='subject', | |
| 27 | + name='students', | |
| 28 | + field=models.ManyToManyField(blank=True, related_name='subject_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
| 29 | + ), | |
| 30 | + migrations.AddField( | |
| 31 | + model_name='material', | |
| 32 | + name='students', | |
| 33 | + field=models.ManyToManyField(related_name='materials', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
| 34 | + ), | |
| 35 | + migrations.AddField( | |
| 36 | + model_name='material', | |
| 37 | + name='topic', | |
| 38 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'), | |
| 39 | + ), | |
| 40 | + migrations.AddField( | |
| 41 | + model_name='linkmaterial', | |
| 42 | + name='material', | |
| 43 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_link', to='courses.Material', verbose_name='Material'), | |
| 44 | + ), | |
| 45 | + migrations.AddField( | |
| 46 | + model_name='filematerial', | |
| 47 | + name='material', | |
| 48 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_file', to='courses.Material', verbose_name='Material'), | |
| 49 | + ), | |
| 50 | + migrations.AddField( | |
| 51 | + model_name='course', | |
| 52 | + name='category', | |
| 53 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_category', to='courses.CourseCategory', verbose_name='Category'), | |
| 54 | + ), | |
| 55 | + migrations.AddField( | |
| 56 | + model_name='course', | |
| 57 | + name='coordenator', | |
| 58 | + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='course_coordenator', to=settings.AUTH_USER_MODEL, verbose_name='Coordenator'), | |
| 59 | + ), | |
| 60 | + migrations.AddField( | |
| 61 | + model_name='activityfile', | |
| 62 | + name='diet', | |
| 63 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='courses.Activity'), | |
| 64 | + ), | |
| 65 | + migrations.AddField( | |
| 66 | + model_name='activity', | |
| 67 | + name='students', | |
| 68 | + field=models.ManyToManyField(related_name='activities', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
| 69 | + ), | |
| 70 | + migrations.AddField( | |
| 71 | + model_name='activity', | |
| 72 | + name='topic', | |
| 73 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'), | |
| 74 | + ), | |
| 75 | + ] | ... | ... |
courses/templates/subject/form_view_student.html
| ... | ... | @@ -63,33 +63,6 @@ |
| 63 | 63 | </ul> |
| 64 | 64 | </div> |
| 65 | 65 | </div> |
| 66 | - <div class="col-xs-4 col-md-4"> | |
| 67 | - <div class="resource_inline"> | |
| 68 | - <h4>{% trans 'Exercises' %}</h4> | |
| 69 | - </div> | |
| 70 | - <div class="resource_inline"> | |
| 71 | - {# dropdown de create exercício #} | |
| 72 | - <div class="dropdown"> | |
| 73 | - <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> | |
| 74 | - <ul class="dropdown-menu" aria-labelledby="dLabel"> | |
| 75 | - <li><a href="javascript:modal.get('{% url 'course:exercise:create_exercise' topic.slug %}', '#createExercisesModal','#requisicoes_ajax')">{% trans 'Create a Exercise' %}</a></li> | |
| 76 | - </ul> | |
| 77 | - </div> | |
| 78 | - </div> | |
| 79 | - <div class="presentation_{{exercise.slug}}"> | |
| 80 | - {# exercício do tópico no modo de visualização #} | |
| 81 | - <ul> | |
| 82 | - {% list_topic_exercise request %} | |
| 83 | - </ul> | |
| 84 | - </div> | |
| 85 | - <div class="editation editation_{{exercise.slug}}"> | |
| 86 | - {# exercício do tópico no modo de edição #} | |
| 87 | - <ul> | |
| 88 | - {% list_topic_exercise_edit request exercise %} | |
| 89 | - </ul> | |
| 90 | - </div> | |
| 91 | - </div> | |
| 92 | - {% include "exercise/create_exercise.html" %} | |
| 93 | 66 | </div> |
| 94 | 67 | {% endif %} |
| 95 | 68 | ... | ... |
courses/templates/subject/form_view_teacher.html
| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | <button class="btn btn-default btn-sm caret-square"><i class="fa fa-caret-square-o-down fa-2x" aria-hidden="true"></i></button> |
| 8 | 8 | </div> |
| 9 | 9 | <div class="col-xs-9 col-md-9 titleTopic"> |
| 10 | - <a role="button"> | |
| 10 | + <a href="{% url 'course:view_topic' topic.slug %}" role="button"> | |
| 11 | 11 | <h4>{{topic}}</h4> |
| 12 | 12 | </a> |
| 13 | 13 | </div><!--column --> |
| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | {% professor_subject topic.subject user as dropdown_topic %} |
| 22 | 22 | {% if dropdown_topic %} |
| 23 | 23 | <ul class="dropdown-menu pull-right" aria-labelledby="moreActions"> |
| 24 | - <li><a href="" data-toggle="modal" data-target="#myModal4"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i> {% trans "Replicate" %}</a></li> | |
| 24 | + <li><a href="{% url 'course:replicate_topic' topic.slug %}"><i class="fa fa-files-o fa-fw" aria-hidden="true"></i> {% trans "Replicate" %}</a></li> | |
| 25 | 25 | <li><a href="javascript:show_editation('{{topic.slug}}')"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i> {% trans "Edit" %}</a></li> |
| 26 | 26 | <li><a href="javascript:void(0)" data-toggle="modal" data-target="#removeTopic"><i class="fa fa-trash fa-fw" aria-hidden="true"></i> {% trans "Remove" %}</a></li> |
| 27 | 27 | </ul> |
| ... | ... | @@ -123,23 +123,6 @@ |
| 123 | 123 | </ul> |
| 124 | 124 | </div> |
| 125 | 125 | </div> |
| 126 | - <div class="col-xs-4 col-md-4"> | |
| 127 | - <div class="resource_inline"> | |
| 128 | - <h4>{% trans 'Exercises' %}</h4> | |
| 129 | - </div> | |
| 130 | - <div class="presentation_{{exercise.slug}}"> | |
| 131 | - {# exercício do tópico no modo de visualização #} | |
| 132 | - <ul> | |
| 133 | - {% list_topic_exercise request %} | |
| 134 | - </ul> | |
| 135 | - </div> | |
| 136 | - <div class="editation editation_{{exercise.slug}}"> | |
| 137 | - {# exercício do tópico no modo de edição #} | |
| 138 | - <ul> | |
| 139 | - {% list_topic_exercise_edit request exercise %} | |
| 140 | - </ul> | |
| 141 | - </div> | |
| 142 | - </div> | |
| 143 | 126 | </div> |
| 144 | 127 | |
| 145 | 128 | {# opções de cancelar e editar no modo de edição #} | ... | ... |
courses/templates/subject/replicate.html
| ... | ... | @@ -2,61 +2,51 @@ |
| 2 | 2 | |
| 3 | 3 | {% load static i18n permission_tags widget_tweaks %} |
| 4 | 4 | |
| 5 | -{% block breadcrumbs %} | |
| 6 | - <ol class="breadcrumb"> | |
| 7 | - <li><a href="{% url 'app:index' %}">{% trans 'Home' %}</a></li> | |
| 8 | - <li class="active">{% trans 'Replicate Subject' %}</li> | |
| 9 | - </ol> | |
| 10 | -{% endblock %} | |
| 11 | - | |
| 12 | 5 | {% block content %} |
| 13 | -<div class="panel panel-default"> | |
| 6 | + | |
| 7 | + <div class="panel panel-default"> | |
| 14 | 8 | <div class="panel-body"> |
| 15 | 9 | <form class="form-group " method="post" action=""> |
| 16 | 10 | {% csrf_token %} |
| 17 | 11 | |
| 18 | 12 | <div class="form-group {% if subject.name.errors %} has-error{% endif %}"> |
| 19 | - <label for="{{ id_name }}" class="control-label label-static"> {% trans 'Name' %}</label> | |
| 20 | - <input class="form-control" id="id_name" maxlength="100" name="name" type="text" required="True" value="{{subject.name}}"> | |
| 21 | - <span class="help-block">{% trans 'Subject name' %}</span> | |
| 13 | + <label for="id_name" class="control-label label-static"> {% trans 'Name'%}</label> | |
| 14 | + <textarea class="form-control" id="id_name" maxlength="100" rows="1" name="name" placeholder="Name" type="text" required >{{subject.name}}</textarea> | |
| 22 | 15 | |
| 16 | + <span class="help-block">{% trans 'Subject name'%}</span> | |
| 23 | 17 | </div> |
| 24 | 18 | |
| 25 | - <div class="form-group {% if subject.name.errors %} has-error{% endif %}"> | |
| 26 | - <label for="{{ id_description }}" class="control-label label-static"> {% trans 'Description' %} </label> | |
| 27 | - <textarea class="form-control" id="id_description" name="description" type="text" required="">{{subject.description}}</textarea> | |
| 28 | - <span class="help-block">{% trans 'Subject Description' %}</span> | |
| 19 | + <div class="form-group"> | |
| 20 | + <label for="id_description" class="control-label label-static"> {% trans 'Description'%}</label> | |
| 21 | + <textarea class="form-control" id="id_description" name="description" placeholder="Description" type="text" >{{subject.description}}</textarea> | |
| 29 | 22 | |
| 23 | + <span class="help-block">{% trans 'Subject description'%}</span> | |
| 30 | 24 | </div> |
| 31 | 25 | |
| 32 | - <div class="form-group {% if subject.name.errors %} has-error{% endif %}"> | |
| 33 | - <label for="{{ id_init_date }}" class="control-label label-static"> {% trans 'Init date' %}</label> | |
| 34 | - <input type="text" class="form-control date-picker" name="{{field.name}}" value="{{field.value|date:'SHORT_DA E_FORMAT'}}" min="{{now|date:'SHORT_DATE_FORMAT'}}"> | |
| 35 | - <span class="help-block">{% trans 'Subject init date' %}</span> | |
| 26 | + <div class="form-group"> | |
| 27 | + <label for="id_init_date" class="control-label label-static"> {% trans 'Init date'%}</label> | |
| 28 | + <input type="text" class="form-control date-picker" name="init_date" value="{{field.value|date:'SHORT_DATE_FORMAT'}}" min="{{now|date:'SHORT_DATE_FORMAT'}}"> | |
| 36 | 29 | |
| 30 | + <span class="help-block">{% trans 'Init date'%}</span> | |
| 37 | 31 | </div> |
| 38 | 32 | |
| 39 | - <div class="form-group {% if subject.name.errors %} has-error{% endif %}"> | |
| 40 | - <label for="{{ id_end_date }}" class="control-label label-static"> {% trans 'End date' %}</label> | |
| 41 | - <input type="text" class="form-control date-picker" name="{{field.name}}" value="{{field.value|date:'SHORT_DA E_FORMAT'}}" min="{{now|date:'SHORT_DATE_FORMAT'}}"> | |
| 42 | - <span class="help-block">{% trans 'Subject end date' %}</span> | |
| 43 | - | |
| 44 | - </div> | |
| 45 | - <div class="form-group {% if subject.name.errors %} has-error{% endif %}"> | |
| 46 | - <label for="{{ id_visible }}" class="control-label label-static"> {% trans 'Visible?' %} </label> | |
| 47 | - <input type="checkbox" class="form-control" id="id_visible" name="visible" required="true"/> | |
| 48 | - <span class="help-block">{% trans 'Is it visible?' %}</span> | |
| 33 | + <div class="form-group"> | |
| 34 | + <label for="id_end_date" class="control-label label-static"> {% trans 'End date'%}</label> | |
| 35 | + <input type="text" class="form-control date-picker" name="end_date" value="{{field.value|date:'SHORT_DATE_FORMAT'}}" min="{{now|date:'SHORT_DATE_FORMAT'}}"> | |
| 49 | 36 | |
| 37 | + <span class="help-block">{% trans 'End date'%}</span> | |
| 50 | 38 | </div> |
| 51 | 39 | |
| 40 | + <div class="form-group"> | |
| 41 | + <label for="id_visible" class="control-label label-static"> {% trans 'Visible'%}</label> | |
| 42 | + <input class="form-control" id="id_visible" name="visible" type="checkbox"/> | |
| 52 | 43 | |
| 44 | + <span class="help-block">{% trans 'Is it visible?'%}</span> | |
| 53 | 45 | </div> |
| 54 | - | |
| 55 | 46 | <div class="col-lg-offset-4 col-lg-4"> |
| 56 | - <button type="submit" class="btn btn-raised btn-primary btn-lg btn-block">{% trans 'Replicate' %}</button> | |
| 47 | + <button type="submite" class="btn btn-raised btn-primary btn-lg btn-block">{% trans 'Replicate' %}</button> | |
| 57 | 48 | </div> |
| 58 | 49 | </form> |
| 59 | - | |
| 60 | 50 | </div> |
| 61 | 51 | </div> |
| 62 | 52 | |
| ... | ... | @@ -70,4 +60,4 @@ |
| 70 | 60 | $('#id_description').summernote({height: 300}); |
| 71 | 61 | }); |
| 72 | 62 | </script> |
| 73 | -{% endblock %} | |
| 74 | 63 | \ No newline at end of file |
| 64 | +{% endblock content %} | ... | ... |
courses/templates/topic/index.html
| ... | ... | @@ -65,7 +65,7 @@ |
| 65 | 65 | </div> |
| 66 | 66 | <div class="panel panel-default"> |
| 67 | 67 | <div class="panel-body"> |
| 68 | - {% include "topic/topic_card_student.html" %} | |
| 68 | + {% include "topic/topic_card.html" %} | |
| 69 | 69 | {% comment %} |
| 70 | 70 | |
| 71 | 71 | |
| ... | ... | @@ -116,13 +116,22 @@ |
| 116 | 116 | </fieldset> |
| 117 | 117 | </form>--> |
| 118 | 118 | {% endcomment %} |
| 119 | - | |
| 120 | - | |
| 121 | - | |
| 122 | - | |
| 123 | 119 | </div> |
| 124 | - | |
| 125 | - | |
| 126 | 120 | </div> |
| 127 | 121 | </div> |
| 122 | + <div class="col-md-6"> | |
| 123 | + <h3>{% trans 'Students - Especific Exercises' %}</h3> | |
| 124 | + <br/> | |
| 125 | + </div> | |
| 126 | + {# mostra a lista de usuários caso seja um professor ou admin #} | |
| 127 | + {% if user|has_role:'professor' or user|has_role:'system_admin' %} | |
| 128 | + {% for user in users %} | |
| 129 | + {% include "exercise/card_list_user.html" %} | |
| 130 | + {% endfor %} | |
| 131 | + {# caso seja um estudante, mostra a lista de exercícios proposta a ele #} | |
| 132 | + {% elif user|has_role:'student'%} | |
| 133 | + {% for exercise in exercises %} | |
| 134 | + {% include "exercise/card_topic_exercises.html" %} | |
| 135 | + {% endfor %} | |
| 136 | + {% endif %} | |
| 128 | 137 | {% endblock %} | ... | ... |
| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | +{% extends 'subject/index.html' %} | |
| 2 | + | |
| 3 | +{% load static i18n permission_tags widget_tweaks %} | |
| 4 | + | |
| 5 | +{% block content %} | |
| 6 | + | |
| 7 | + <div class="panel panel-default"> | |
| 8 | + <div class="panel-body"> | |
| 9 | + <form class="form-group " method="post" action=""> | |
| 10 | + {% csrf_token %} | |
| 11 | + | |
| 12 | + <div class="form-group {% if topic.name.errors %} has-error{% endif %}"> | |
| 13 | + <label for="id_name" class="control-label label-static"> {% trans 'Name'%}</label> | |
| 14 | + <textarea class="form-control" id="id_name" maxlength="100" rows="1" name="name" placeholder="Name" type="text" required >{{topic.name}}</textarea> | |
| 15 | + | |
| 16 | + <span class="help-block">{% trans 'Topic name'%}</span> | |
| 17 | + </div> | |
| 18 | + <div class="form-group {% if topic.description.errors %} has-error{% endif %}"> | |
| 19 | + <label for="id_description" class="control-label label-static"> {% trans 'Description'%}</label> | |
| 20 | + <textarea class="form-control" id="id_description" name="description" placeholder="Description" type="text"> {{topic.description}}</textarea> | |
| 21 | + | |
| 22 | + <span class="help-block">{% trans 'Topic description'%}</span> | |
| 23 | + </div> | |
| 24 | + | |
| 25 | + <div class="col-lg-offset-4 col-lg-4"> | |
| 26 | + <button type="submit" class="btn btn-raised btn-primary btn-lg btn-block">{% trans 'Create' %}</button> | |
| 27 | + | |
| 28 | + </div> | |
| 29 | + </form> | |
| 30 | + </div> | |
| 31 | + </div> | |
| 32 | + | |
| 33 | + <script type="text/javascript"> | |
| 34 | + $(document).ready(function() { | |
| 35 | + $('#id_description').summernote({height: 300}); | |
| 36 | + }); | |
| 37 | + </script> | |
| 38 | +{% endblock content %} | ... | ... |
courses/templates/topic/replicate_topic.html
| ... | ... | @@ -1,38 +0,0 @@ |
| 1 | -{% extends 'subject/index.html' %} | |
| 2 | - | |
| 3 | -{% load static i18n permission_tags widget_tweaks %} | |
| 4 | - | |
| 5 | -{% block content %} | |
| 6 | - | |
| 7 | - <div class="panel panel-default"> | |
| 8 | - <div class="panel-body"> | |
| 9 | - <form class="form-group " method="post" action=""> | |
| 10 | - {% csrf_token %} | |
| 11 | - | |
| 12 | - <div class="form-group {% if topic.name.errors %} has-error{% endif %}"> | |
| 13 | - <label for="id_name" class="control-label label-static"> {% trans 'Name'%}</label> | |
| 14 | - <input class="form-control" id="id_name" maxlength="100" name="name" placeholder="Name" type="text" value={{topic.name}} required /> | |
| 15 | - | |
| 16 | - <span class="help-block">{% trans 'Topic name'%}</span> | |
| 17 | - </div> | |
| 18 | - <div class="form-group {% if topic.description.errors %} has-error{% endif %}"> | |
| 19 | - <label for="id_description" class="control-label label-static"> {% trans 'Description'%}</label> | |
| 20 | - <textarea class="form-control" id="id_description" name="description" placeholder="Description" type="text"> {{topic.description}}</textarea> | |
| 21 | - | |
| 22 | - <span class="help-block">{% trans 'Topic description'%}</span> | |
| 23 | - </div> | |
| 24 | - | |
| 25 | - <div class="col-lg-offset-4 col-lg-4"> | |
| 26 | - <button type="submit" class="btn btn-raised btn-primary btn-lg btn-block">{% trans 'Create' %}</button> | |
| 27 | - | |
| 28 | - </div> | |
| 29 | - </form> | |
| 30 | - </div> | |
| 31 | - </div> | |
| 32 | - | |
| 33 | - <script type="text/javascript"> | |
| 34 | - $(document).ready(function() { | |
| 35 | - $('#id_description').summernote({height: 300}); | |
| 36 | - }); | |
| 37 | - </script> | |
| 38 | -{% endblock content %} |
| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | +{% load static i18n list_topic_foruns permission_tags widget_tweaks professor_access%} | |
| 2 | + | |
| 3 | + | |
| 4 | +<div class="row"> | |
| 5 | + <div class="col-xs-6 col-md-6"> | |
| 6 | + <div class="resource_inline"> | |
| 7 | + <h4>{% trans "Materials" %}</h4> | |
| 8 | + </div> | |
| 9 | + | |
| 10 | + <ul id="list-materials"> | |
| 11 | + {% list_topic_file request topic %} | |
| 12 | + {% list_topic_link request topic%} | |
| 13 | + | |
| 14 | + </ul> | |
| 15 | + </div> | |
| 16 | + <div class="col-xs-6 col-md-6"> | |
| 17 | + <div class="resource_inline"> | |
| 18 | + <h4>{% trans "Activities" %}</h4> | |
| 19 | + </div> | |
| 20 | + <ul> | |
| 21 | + <div class="foruns_list"> | |
| 22 | + {# {% list_topic_exam request topic %} #} | |
| 23 | + {% list_topic_poll request topic %} | |
| 24 | + {% list_topic_foruns request topic %} | |
| 25 | + </div> | |
| 26 | + </ul> | |
| 27 | + </div> | |
| 28 | +</div> | |
| 0 | 29 | \ No newline at end of file | ... | ... |
courses/templates/topic/topic_card_student.html
| ... | ... | @@ -1,29 +0,0 @@ |
| 1 | -{% load static i18n list_topic_foruns permission_tags widget_tweaks professor_access%} | |
| 2 | - | |
| 3 | - | |
| 4 | -<div class="row"> | |
| 5 | - <div class="col-xs-6 col-md-6"> | |
| 6 | - <div class="resource_inline"> | |
| 7 | - <h4>{% trans "Materials" %}</h4> | |
| 8 | - </div> | |
| 9 | - | |
| 10 | - <ul id="list-materials"> | |
| 11 | - {% list_topic_file request topic %} | |
| 12 | - {% list_topic_link request topic%} | |
| 13 | - | |
| 14 | - </ul> | |
| 15 | - </div> | |
| 16 | - <div class="col-xs-4 col-md-4"> | |
| 17 | - <div class="resource_inline"> | |
| 18 | - <h4>{% trans "Activities" %}</h4> | |
| 19 | - </div> | |
| 20 | - <ul> | |
| 21 | - <div class="foruns_list"> | |
| 22 | - {% list_topic_exam request topic %} | |
| 23 | - {% list_topic_poll request topic %} | |
| 24 | - {% list_topic_foruns request topic %} | |
| 25 | - </div> | |
| 26 | - </ul> | |
| 27 | - </div> | |
| 28 | - | |
| 29 | -</div> |
courses/urls.py
| ... | ... | @@ -6,7 +6,6 @@ urlpatterns = [ |
| 6 | 6 | url(r'^all-courses/$', views.AllCoursesView.as_view(), name='all_courses'), |
| 7 | 7 | url(r'^create/$', views.CreateCourseView.as_view(), name='create'), |
| 8 | 8 | url(r'^replicate_course/(?P<slug>[\w_-]+)/$', views.ReplicateCourseView.as_view(), name='replicate_course'), |
| 9 | - url(r'^replicate_subject/(?P<slug>[\w_-]+)/$', views.ReplicateSubjectView.as_view(), name='replicate_subject'), | |
| 10 | 9 | url(r'^edit/(?P<slug>[\w_-]+)/$', views.UpdateCourseView.as_view(), name='update'), |
| 11 | 10 | url(r'^delete/(?P<slug>[\w_-]+)/$', views.DeleteCourseView.as_view(), name='delete'), |
| 12 | 11 | url(r'^subscribe/(?P<slug>[\w_-]+)/$', views.subscribe_course, name='subscribe'), |
| ... | ... | @@ -19,10 +18,11 @@ urlpatterns = [ |
| 19 | 18 | url(r'^subjects/create/(?P<slug>[\w_-]+)/$', views.CreateSubjectView.as_view(), name='create_subject'), |
| 20 | 19 | url(r'^subjects/update/(?P<slug>[\w_-]+)/$', views.UpdateSubjectView.as_view(), name='update_subject'), |
| 21 | 20 | url(r'^subjects/delete/(?P<slug>[\w_-]+)/$', views.DeleteSubjectView.as_view(), name='delete_subject'), |
| 21 | + url(r'^subjects/replicate/(?P<slug>[\w_-]+)/$', views.ReplicateSubjectView.as_view(), name='replicate_subject'), | |
| 22 | 22 | url(r'^subjects/subscribe/(?P<slug>[\w_-]+)/$', views.subscribe_subject, name='subscribe_subject'), |
| 23 | 23 | url(r'^topics/create/(?P<slug>[\w_-]+)/$', views.CreateTopicView.as_view(), name='create_topic'), |
| 24 | 24 | url(r'^topics/update/(?P<slug>[\w_-]+)/$', views.UpdateTopicView.as_view(), name='update_topic'), |
| 25 | - url(r'^topics/update/(?P<slug>[\w_-]+)/$', views.DeleteTopic.as_view(), name='delete_topic'), | |
| 25 | + url(r'^topics/delete/(?P<slug>[\w_-]+)/$', views.DeleteTopic.as_view(), name='delete_topic'), | |
| 26 | 26 | url(r'^topics/replicate/(?P<slug>[\w_-]+)/$', views.ReplicateTopicView.as_view(), name='replicate_topic'), |
| 27 | 27 | url(r'^topics/(?P<slug>[\w_-]+)/$', views.TopicsView.as_view(), name='view_topic'), |
| 28 | 28 | url(r'^subjects/categories$',views.IndexSubjectCategoryView.as_view(), name='subject_category_index'), | ... | ... |
courses/views.py
| ... | ... | @@ -562,39 +562,6 @@ class SubjectsView(LoginRequiredMixin, LogMixin, generic.ListView): |
| 562 | 562 | context['files'] = TopicFile.objects.filter(students__name = self.request.user.name) |
| 563 | 563 | return context |
| 564 | 564 | |
| 565 | -class ReplicateSubjectView(LoginRequiredMixin, HasRoleMixin, LogMixin, NotificationMixin,generic.edit.CreateView): | |
| 566 | - | |
| 567 | - allowed_roles = ['professor', 'system_admin'] | |
| 568 | - login_url = reverse_lazy("core:home") | |
| 569 | - redirect_field_name = 'next' | |
| 570 | - template_name = 'subject/replicate.html' | |
| 571 | - form_class = SubjectForm | |
| 572 | - success_url = reverse_lazy('course:view') | |
| 573 | - | |
| 574 | - def get_context_data(self, **kwargs): | |
| 575 | - context = super(ReplicateSubjectView, self).get_context_data(**kwargs) | |
| 576 | - subject = get_object_or_404(Subject, slug=self.kwargs.get('slug')) | |
| 577 | - | |
| 578 | - if has_role(self.request.user,'system_admin'): | |
| 579 | - subjects = Subject.objects.all() | |
| 580 | - context['subjects'] = subjects | |
| 581 | - elif has_role(self.request.user,'professor'): | |
| 582 | - subject = self.request.user.professors_subjects.all() | |
| 583 | - categorys_subjects = CategorySubject.objects.all() | |
| 584 | - | |
| 585 | - context['subject'] = subject | |
| 586 | - context['categorys_subjects'] = categorys_subjects | |
| 587 | - context['title'] = _("Replicate Subject") | |
| 588 | - context['now'] = date.today() | |
| 589 | - return context | |
| 590 | - | |
| 591 | - def form_valid(self, form): | |
| 592 | - self.object = form.save() | |
| 593 | - | |
| 594 | - return super(ReplicateSubjectView, self).form_valid(form) | |
| 595 | - | |
| 596 | - def get_success_url(self): | |
| 597 | - return reverse_lazy('course:view', kwargs={'slug' : self.object.slug}) | |
| 598 | 565 | |
| 599 | 566 | class UploadMaterialView(LoginRequiredMixin, generic.edit.CreateView): |
| 600 | 567 | login_url = reverse_lazy("core:home") |
| ... | ... | @@ -664,6 +631,12 @@ class TopicsView(LoginRequiredMixin, LogMixin, generic.ListView): |
| 664 | 631 | activitys = Activity.objects.filter(topic__name = topic.name) |
| 665 | 632 | students_activit = User.objects.filter(activities__in = Activity.objects.all()) |
| 666 | 633 | materials = Material.objects.filter(topic = topic) |
| 634 | + if has_role(self.request.user, 'professor'): | |
| 635 | + users = User.objects.filter(subject_student__in = Subject.objects.all()) | |
| 636 | + context['users'] = users | |
| 637 | + elif has_role(self.request.user, 'student'): | |
| 638 | + exercises = Exercise.objects.all().filter(students=self.request.user) | |
| 639 | + context['exercises'] = exercises | |
| 667 | 640 | |
| 668 | 641 | context['topic'] = topic |
| 669 | 642 | context['subject'] = topic.subject |
| ... | ... | @@ -1018,13 +991,13 @@ class TopicViewSet(viewsets.ModelViewSet): |
| 1018 | 991 | class ReplicateTopicView (LoginRequiredMixin, HasRoleMixin, LogMixin, NotificationMixin,generic.edit.CreateView): |
| 1019 | 992 | log_component = "course" |
| 1020 | 993 | log_resource = "topic" |
| 1021 | - log_action = "create" | |
| 994 | + log_action = "replicate" | |
| 1022 | 995 | log_context = {} |
| 1023 | 996 | |
| 1024 | 997 | allowed_roles = ['professor', 'system_admin'] |
| 1025 | 998 | login_url = reverse_lazy("core:home") |
| 1026 | - model = Topic | |
| 1027 | - template_name = 'topic/replicate_topic.html' | |
| 999 | + redirect_field_name = 'next' | |
| 1000 | + template_name = 'topic/replicate.html' | |
| 1028 | 1001 | form_class = TopicForm |
| 1029 | 1002 | |
| 1030 | 1003 | def get_success_url(self): |
| ... | ... | @@ -1033,21 +1006,23 @@ class ReplicateTopicView (LoginRequiredMixin, HasRoleMixin, LogMixin, Notificati |
| 1033 | 1006 | def get_context_data(self, **kwargs): |
| 1034 | 1007 | context = super(ReplicateTopicView, self).get_context_data(**kwargs) |
| 1035 | 1008 | topic = get_object_or_404(Topic, slug = self.kwargs.get('slug')) |
| 1036 | - subject = topic.subject | |
| 1009 | + subject = Subject.objects.get(pk = topic.subject_id) | |
| 1037 | 1010 | context['course'] = subject.course |
| 1038 | 1011 | context['subject'] = subject |
| 1039 | 1012 | context['subjects'] = subject.course.subjects.all() |
| 1040 | 1013 | context['topic'] = topic |
| 1041 | 1014 | return context |
| 1042 | 1015 | |
| 1043 | - | |
| 1044 | 1016 | def form_valid(self, form): |
| 1045 | - self.object.subject = self.object.subject.id | |
| 1017 | + topic = get_object_or_404(Topic, slug = self.kwargs.get('slug')) | |
| 1018 | + subject = Subject.objects.get(pk = topic.subject_id) | |
| 1019 | + | |
| 1046 | 1020 | self.object = form.save(commit = False) |
| 1021 | + self.object.topic = topic | |
| 1022 | + self.object.subject = subject | |
| 1047 | 1023 | self.object.owner = self.request.user |
| 1048 | 1024 | self.object.save() |
| 1049 | - | |
| 1050 | - action = super(ReplicateTopicView, self).createorRetrieveAction("replicate Topic") | |
| 1025 | + action = super(ReplicateTopicView, self).createorRetrieveAction("create Topic") | |
| 1051 | 1026 | super(ReplicateTopicView, self).createNotification("Topic "+ self.object.name + " was created", |
| 1052 | 1027 | resource_name=self.object.name, resource_link= reverse('course:view_topic',args=[self.object.slug]), |
| 1053 | 1028 | actor=self.request.user, users = self.object.subject.course.students.all() ) |
| ... | ... | @@ -1067,3 +1042,55 @@ class ReplicateTopicView (LoginRequiredMixin, HasRoleMixin, LogMixin, Notificati |
| 1067 | 1042 | super(ReplicateTopicView, self).createLog(self.request.user, self.log_component, self.log_action, self.log_resource, self.log_context) |
| 1068 | 1043 | |
| 1069 | 1044 | return super(ReplicateTopicView, self).form_valid(form) |
| 1045 | + | |
| 1046 | +class ReplicateSubjectView(LoginRequiredMixin, HasRoleMixin, LogMixin, NotificationMixin, generic.edit.CreateView): | |
| 1047 | + log_component = "course" | |
| 1048 | + log_resource = "subject" | |
| 1049 | + log_action = "replicate" | |
| 1050 | + log_context = {} | |
| 1051 | + | |
| 1052 | + allowed_roles = ['professor', 'system_admin'] | |
| 1053 | + login_url = reverse_lazy("core:home") | |
| 1054 | + redirect_field_name = 'next' | |
| 1055 | + template_name = 'subject/replicate.html' | |
| 1056 | + form_class = SubjectForm | |
| 1057 | + | |
| 1058 | + def get_success_url(self): | |
| 1059 | + return reverse_lazy('course:view_subject', kwargs={'slug' : self.object.slug}) | |
| 1060 | + | |
| 1061 | + def get_context_data(self, **kwargs): | |
| 1062 | + context = super(ReplicateSubjectView, self).get_context_data(**kwargs) | |
| 1063 | + subject = get_object_or_404(Subject, slug = self.kwargs.get('slug')) | |
| 1064 | + course = Course.objects.get(pk=subject.course_id) | |
| 1065 | + context['course'] = course | |
| 1066 | + context['subjects'] = course.subjects.filter(Q(visible=True) | Q(professors__in=[self.request.user])) | |
| 1067 | + context['subject'] = subject | |
| 1068 | + if (has_role(self.request.user,'system_admin')): | |
| 1069 | + context['subjects'] = course.subjects.all() | |
| 1070 | + return context | |
| 1071 | + | |
| 1072 | + def form_valid(self, form): | |
| 1073 | + subject = get_object_or_404(Subject, slug = self.kwargs.get('slug')) | |
| 1074 | + course = Course.objects.get(pk=subject.course_id) | |
| 1075 | + | |
| 1076 | + self.object = form.save(commit = False) | |
| 1077 | + self.object.course = course | |
| 1078 | + self.object.save() | |
| 1079 | + self.object.professors.add(self.request.user) | |
| 1080 | + if self.object.visible: | |
| 1081 | + super(ReplicateSubjectView, self).createNotification( " created subject " + self.object.name, resource_name=self.object.name, | |
| 1082 | + resource_slug = self.object.slug, actor=self.request.user, users= self.object.course.students.all(), | |
| 1083 | + resource_link = reverse('course:view_subject', args=[self.object.slug])) | |
| 1084 | + | |
| 1085 | + self.log_context['subject_id'] = self.object.id | |
| 1086 | + self.log_context['subject_name'] = self.object.name | |
| 1087 | + self.log_context['subject_slug'] = self.object.slug | |
| 1088 | + self.log_context['course_id'] = course.id | |
| 1089 | + self.log_context['course_name'] = course.name | |
| 1090 | + self.log_context['course_slug'] = course.slug | |
| 1091 | + self.log_context['course_category_id'] = course.category.id | |
| 1092 | + self.log_context['course_category_name'] = course.category.name | |
| 1093 | + | |
| 1094 | + super(ReplicateSubjectView, self).createLog(self.request.user, self.log_component, self.log_action, self.log_resource, self.log_context) | |
| 1095 | + | |
| 1096 | + return super(ReplicateSubjectView, self).form_valid(form) | ... | ... |
exam/migrations/0001_initial.py
| 1 | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-16 13:57 | |
| 2 | + | |
| 3 | +# Generated by Django 1.10 on 2016-11-15 22:36 | |
| 3 | 4 | from __future__ import unicode_literals |
| 4 | 5 | |
| 5 | 6 | from django.db import migrations, models |
| ... | ... | @@ -23,9 +24,10 @@ class Migration(migrations.Migration): |
| 23 | 24 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), |
| 24 | 25 | ], |
| 25 | 26 | options={ |
| 27 | + 'verbose_name': 'Answer', | |
| 28 | + 'ordering': ('order',), | |
| 26 | 29 | 'verbose_name_plural': 'Answers', |
| 27 | 30 | 'ordering': ('order',), |
| 28 | - 'verbose_name': 'Answer', | |
| 29 | 31 | }, |
| 30 | 32 | ), |
| 31 | 33 | migrations.CreateModel( |
| ... | ... | @@ -37,8 +39,8 @@ class Migration(migrations.Migration): |
| 37 | 39 | ('answer', models.ManyToManyField(related_name='student_answer', to='exam.Answer', verbose_name='Answers Students')), |
| 38 | 40 | ], |
| 39 | 41 | options={ |
| 40 | - 'verbose_name_plural': 'Answers Student', | |
| 41 | 42 | 'verbose_name': 'Answer Stundent', |
| 43 | + 'verbose_name_plural': 'Answers Student', | |
| 42 | 44 | }, |
| 43 | 45 | ), |
| 44 | 46 | migrations.CreateModel( |
| ... | ... | @@ -49,8 +51,8 @@ class Migration(migrations.Migration): |
| 49 | 51 | ('exibe', models.BooleanField(default=False, verbose_name='Exibe?')), |
| 50 | 52 | ], |
| 51 | 53 | options={ |
| 52 | - 'verbose_name_plural': 'Exams', | |
| 53 | 54 | 'verbose_name': 'Exam', |
| 55 | + 'verbose_name_plural': 'Exams', | |
| 54 | 56 | }, |
| 55 | 57 | bases=('courses.activity',), |
| 56 | 58 | ), | ... | ... |
| ... | ... | @@ -0,0 +1,30 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 | |
| 3 | +from __future__ import unicode_literals | |
| 4 | + | |
| 5 | +from django.conf import settings | |
| 6 | +from django.db import migrations, models | |
| 7 | +import django.db.models.deletion | |
| 8 | + | |
| 9 | + | |
| 10 | +class Migration(migrations.Migration): | |
| 11 | + | |
| 12 | + initial = True | |
| 13 | + | |
| 14 | + dependencies = [ | |
| 15 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
| 16 | + ('exam', '0001_initial'), | |
| 17 | + ] | |
| 18 | + | |
| 19 | + operations = [ | |
| 20 | + migrations.AddField( | |
| 21 | + model_name='answersstudent', | |
| 22 | + name='student', | |
| 23 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student', to=settings.AUTH_USER_MODEL, verbose_name='Student'), | |
| 24 | + ), | |
| 25 | + migrations.AddField( | |
| 26 | + model_name='answer', | |
| 27 | + name='exam', | |
| 28 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='exam.Exam', verbose_name='Answers'), | |
| 29 | + ), | |
| 30 | + ] | ... | ... |
exam/migrations/0002_auto_20161116_1057.py
| ... | ... | @@ -1,30 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -# Generated by Django 1.10 on 2016-11-16 13:57 | |
| 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 | - ('exam', '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='student', to=settings.AUTH_USER_MODEL, verbose_name='Student'), | |
| 24 | - ), | |
| 25 | - migrations.AddField( | |
| 26 | - model_name='answer', | |
| 27 | - name='exam', | |
| 28 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='exam.Exam', verbose_name='Answers'), | |
| 29 | - ), | |
| 30 | - ] |
| ... | ... | @@ -0,0 +1,30 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
| 3 | +from __future__ import unicode_literals | |
| 4 | + | |
| 5 | +from django.conf import settings | |
| 6 | +from django.db import migrations, models | |
| 7 | +import django.db.models.deletion | |
| 8 | + | |
| 9 | + | |
| 10 | +class Migration(migrations.Migration): | |
| 11 | + | |
| 12 | + initial = True | |
| 13 | + | |
| 14 | + dependencies = [ | |
| 15 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
| 16 | + ('exam', '0001_initial'), | |
| 17 | + ] | |
| 18 | + | |
| 19 | + operations = [ | |
| 20 | + migrations.AddField( | |
| 21 | + model_name='answersstudent', | |
| 22 | + name='student', | |
| 23 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student', to=settings.AUTH_USER_MODEL, verbose_name='Student'), | |
| 24 | + ), | |
| 25 | + migrations.AddField( | |
| 26 | + model_name='answer', | |
| 27 | + name='exam', | |
| 28 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='exam.Exam', verbose_name='Answers'), | |
| 29 | + ), | |
| 30 | + ] | ... | ... |
exercise/admin.py
| 1 | 1 | from django.contrib import admin |
| 2 | -from .models import Exercise | |
| 2 | +from .models import Exercise, File | |
| 3 | 3 | |
| 4 | 4 | class ExerciseAdmin(admin.ModelAdmin): |
| 5 | 5 | list_display = ['name'] |
| 6 | 6 | search_fields = ['name'] |
| 7 | 7 | |
| 8 | +class FileAdmin(admin.ModelAdmin): | |
| 9 | + list_display = ['name'] | |
| 10 | + search_fields = ['name'] | |
| 11 | + | |
| 8 | 12 | admin.site.register(Exercise, ExerciseAdmin) |
| 13 | +admin.site.register(File, ExerciseAdmin) | ... | ... |
exercise/forms.py
| ... | ... | @@ -9,11 +9,11 @@ class ExerciseForm(forms.ModelForm): |
| 9 | 9 | |
| 10 | 10 | class Meta: |
| 11 | 11 | model = Exercise |
| 12 | - fields = ['name', 'file'] | |
| 12 | + fields = ['name'] | |
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | class UpdateExerciseForm(forms.ModelForm): |
| 16 | 16 | |
| 17 | 17 | class Meta: |
| 18 | 18 | model = Exercise |
| 19 | - fields = ['name', 'file'] | |
| 19 | + fields = ['name'] | ... | ... |
exercise/migrations/0001_initial.py
| 1 | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-16 13:57 | |
| 2 | + | |
| 3 | +# Generated by Django 1.10 on 2016-11-15 22:36 | |
| 3 | 4 | from __future__ import unicode_literals |
| 4 | 5 | |
| 6 | +from decimal import Decimal | |
| 5 | 7 | from django.db import migrations, models |
| 6 | 8 | import django.db.models.deletion |
| 7 | 9 | |
| ... | ... | @@ -11,7 +13,6 @@ class Migration(migrations.Migration): |
| 11 | 13 | initial = True |
| 12 | 14 | |
| 13 | 15 | dependencies = [ |
| 14 | - ('courses', '0001_initial'), | |
| 15 | 16 | ] |
| 16 | 17 | |
| 17 | 18 | operations = [ |
| ... | ... | @@ -19,9 +20,20 @@ class Migration(migrations.Migration): |
| 19 | 20 | name='Exercise', |
| 20 | 21 | fields=[ |
| 21 | 22 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
| 22 | - ('file', models.FileField(upload_to='uploads/%Y/%m/%d')), | |
| 23 | + ('description', models.TextField(blank=True, verbose_name='Descrição')), | |
| 24 | + ('init_date', models.DateField(verbose_name='Begin of Subject Date')), | |
| 25 | + ('end_date', models.DateField(verbose_name='End of Subject Date')), | |
| 26 | + ('grade', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=20, null=True)), | |
| 23 | 27 | ('name', models.CharField(max_length=100)), |
| 24 | - ('topic', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='exercises', to='courses.Topic', verbose_name='Topic')), | |
| 28 | + ], | |
| 29 | + ), | |
| 30 | + migrations.CreateModel( | |
| 31 | + name='File', | |
| 32 | + fields=[ | |
| 33 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |
| 34 | + ('name', models.CharField(max_length=100)), | |
| 35 | + ('file', models.FileField(upload_to='uploads/%Y/%m/%d')), | |
| 36 | + ('exercise', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='file', to='exercise.Exercise')), | |
| 25 | 37 | ], |
| 26 | 38 | ), |
| 27 | 39 | ] | ... | ... |
| ... | ... | @@ -0,0 +1,36 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
| 3 | +from __future__ import unicode_literals | |
| 4 | + | |
| 5 | +from django.conf import settings | |
| 6 | +from django.db import migrations, models | |
| 7 | +import django.db.models.deletion | |
| 8 | + | |
| 9 | + | |
| 10 | +class Migration(migrations.Migration): | |
| 11 | + | |
| 12 | + initial = True | |
| 13 | + | |
| 14 | + dependencies = [ | |
| 15 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
| 16 | + ('exercise', '0001_initial'), | |
| 17 | + ('courses', '0002_auto_20161117_0009'), | |
| 18 | + ] | |
| 19 | + | |
| 20 | + operations = [ | |
| 21 | + migrations.AddField( | |
| 22 | + model_name='exercise', | |
| 23 | + name='professors', | |
| 24 | + field=models.ManyToManyField(blank=True, related_name='professors_exercise', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | |
| 25 | + ), | |
| 26 | + migrations.AddField( | |
| 27 | + model_name='exercise', | |
| 28 | + name='students', | |
| 29 | + field=models.ManyToManyField(blank=True, related_name='subject_exercise', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
| 30 | + ), | |
| 31 | + migrations.AddField( | |
| 32 | + model_name='exercise', | |
| 33 | + name='topic', | |
| 34 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='exercises', to='courses.Topic', verbose_name='Topic'), | |
| 35 | + ), | |
| 36 | + ] | ... | ... |
exercise/models.py
| 1 | -from django.db import models | |
| 2 | 1 | from courses.models import Topic |
| 2 | +from decimal import Decimal | |
| 3 | +from django.db import models | |
| 3 | 4 | from django.utils.translation import ugettext_lazy as _ |
| 5 | +from users.models import User | |
| 4 | 6 | |
| 5 | 7 | """ |
| 6 | 8 | Function to return the path where the file should be saved |
| ... | ... | @@ -15,8 +17,24 @@ def file_path(instance, filename): |
| 15 | 17 | It represents the Exercises inside topic. |
| 16 | 18 | """ |
| 17 | 19 | |
| 18 | - | |
| 19 | 20 | class Exercise(models.Model): |
| 20 | 21 | topic = models.ForeignKey(Topic, verbose_name=_('Topic'), related_name='exercises') |
| 21 | - file = models.FileField(upload_to='uploads/%Y/%m/%d') | |
| 22 | + professors = models.ManyToManyField(User, verbose_name=_('Professors'), related_name='professors_exercise', blank=True) | |
| 23 | + students = models.ManyToManyField(User, verbose_name=_('Students'), related_name='subject_exercise', blank = True) | |
| 24 | + description = models.TextField(_('Descrição'), blank=True) | |
| 25 | + init_date = models.DateField(_('Begin of Subject Date')) | |
| 26 | + end_date = models.DateField(_('End of Subject Date')) | |
| 27 | + grade = models.DecimalField(max_digits=20, decimal_places=2, default=Decimal('0.00'), null=True) | |
| 28 | + name = models.CharField(max_length=100) | |
| 29 | + | |
| 30 | + def __str__(self): | |
| 31 | + return self.name | |
| 32 | + | |
| 33 | + | |
| 34 | +class File(models.Model): | |
| 22 | 35 | name = models.CharField(max_length=100) |
| 36 | + file = models.FileField(upload_to='uploads/%Y/%m/%d') | |
| 37 | + exercise = models.ForeignKey(Exercise, related_name='file') | |
| 38 | + | |
| 39 | + def __str__(self): | |
| 40 | + return self.name | |
| 23 | 41 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,33 @@ |
| 1 | +{% load static i18n list_topic_foruns permission_tags widget_tweaks professor_access list_topic_exercises %} | |
| 2 | + | |
| 3 | + <div class="col-md-12 col-sm-12 col-lg-12"> | |
| 4 | + <div class="panel-group accordion ui-accordion ui-widget ui-helper-reset ui-sortable" role="tablist" aria-multiselectable="false"> | |
| 5 | + <div class="group"><div class="panel panel-default"> | |
| 6 | + <div class="panel-heading topic ui-sortable-handle" role="tab"> | |
| 7 | + <div class="row"> | |
| 8 | + <div class="col-md-1 moreAccordion" data-toggle="collapse" data-parent="#accordion-{{user.id}}" href=".collapseTopic-{{user.id}}" aria-expanded="false" aria-controls="collapseTopic-{{user.id}}"> | |
| 9 | + <button class="btn btn-default btn-sm caret-square"><i class="fa fa-caret-square-o-down fa-2x" aria-hidden="true"></i></button> | |
| 10 | + </div> | |
| 11 | + <div class="col-xs-9 col-md-9 titleTopic"> | |
| 12 | + <a href="" role="button"> | |
| 13 | + <h4>{{user|capfirst}}</h4> | |
| 14 | + </a> | |
| 15 | + </div> | |
| 16 | + </div> | |
| 17 | + </div> | |
| 18 | + <div class="panel-collapse collapseTopic-{{user.id}} collapse in" role="tabpanel" aria-labelledby="heading_{{user.id}}" aria-expanded="true" aria-hidden="false"> | |
| 19 | + <div class="panel-body"> | |
| 20 | + <div class="presentation"> | |
| 21 | + <p> | |
| 22 | + <i> | |
| 23 | + | |
| 24 | + </i> | |
| 25 | + </p> | |
| 26 | + | |
| 27 | + </div> | |
| 28 | + </div> | |
| 29 | + </div> | |
| 30 | + </div> | |
| 31 | + </div> | |
| 32 | + </div> | |
| 33 | +</div> | |
| 0 | 34 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,62 @@ |
| 1 | +{% load static widget_tweaks i18n %} | |
| 2 | + | |
| 3 | +<div class="col-lg-4 col-xs-4 col-sm-4"> | |
| 4 | + <div class="panel panel-default"> | |
| 5 | + <div class="panel-body"> | |
| 6 | + <form class="form-horizontal"> | |
| 7 | + <fieldset> | |
| 8 | + <center><legend>{{exercise.name}}</legend></center> | |
| 9 | + <div class="container-fluid"> | |
| 10 | + <div class="form-group"> | |
| 11 | + <label class="col-md-2 col-xs-2 col-sm-2 control-label">Describe: </label><br> | |
| 12 | + {% if exercise.description%} | |
| 13 | + {{exercise.description}} | |
| 14 | + {% else %} | |
| 15 | + {% trans "Don't have description" %} | |
| 16 | + {% endif %} | |
| 17 | + </div> | |
| 18 | + <div class="form-group"> | |
| 19 | + <label class="col-md-2 col-xs-2 col-sm-2 control-label">Opening: </label><br>{{exercise.init_date}} | |
| 20 | + | |
| 21 | + </div> | |
| 22 | + <div class="form-group"> | |
| 23 | + <label class="col-md-2 col-xs-2 col-sm-2 control-label">Ending: </label><br>{{exercise.end_date}} | |
| 24 | + | |
| 25 | + </div> | |
| 26 | + <div class="form-group"> | |
| 27 | + <label for="nota" class="col-md-2 control-label">NOTA: | |
| 28 | + {% if exercise.grade %} | |
| 29 | + <div class="col-md-4"> | |
| 30 | + <p id="nota" class="form-control"> | |
| 31 | + {{exercise.grade}} | |
| 32 | + </p> | |
| 33 | + </div> | |
| 34 | + {% else %} | |
| 35 | + {% trans 'Not yet' %} | |
| 36 | + {% endif %} | |
| 37 | + </label> | |
| 38 | + </div> | |
| 39 | + {% if exercise.file %} | |
| 40 | + <div class="form-group"> | |
| 41 | + <label for="DelExc" class="col-md-4 control-label"> <i class="fa fa-file-archive-o fa-3x" aria-hidden="true"> | |
| 42 | + {% for file in exercise.file %} | |
| 43 | + <a href="{{exercise.file.url}}">{% trans 'File' %}</a> | |
| 44 | + {% endfor %} | |
| 45 | + </i> | |
| 46 | + </div> | |
| 47 | + {% else %} | |
| 48 | + <p>{% trans 'Exercise not yet' %}</p> | |
| 49 | + {% endif %} | |
| 50 | + {% if not exercise.grade %} | |
| 51 | + <div class="form-group"> | |
| 52 | + <label class="col-md-6 control-label"><i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>{% trans 'Teacher waiting corretion' %} | |
| 53 | + </div> | |
| 54 | + {% endif %} | |
| 55 | + </div> | |
| 56 | + | |
| 57 | + </fieldset> | |
| 58 | + </form> | |
| 59 | + | |
| 60 | + </div> | |
| 61 | + </div> | |
| 62 | +</div> | |
| 0 | 63 | \ No newline at end of file | ... | ... |
exercise/templates/exercise/exercise_edit.html
| 1 | 1 | {% load static i18n list_topic_foruns permission_tags %} |
| 2 | -<div id="exercise-topic{{ exercise.id }}-exercises-edit"> | |
| 2 | +<div id="exercise-topic{{ topic.id }}-exercises-edit"> | |
| 3 | 3 | {% for exercise in exercises %} |
| 4 | 4 | <li class="icon_edit_remove" id = "exercise_edit_icon_{{ exercise.slug }}"> <a href="javascript:modal.get('', '#exercisesModalEdit', '#requisicoes_ajax')"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a> <a href="javascript:modal.get('', '#exerciseDeleteModal', '#requisicoes_ajax')"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a></li> |
| 5 | 5 | <li id = "exercise_edit_{{ exercise.slug }}"><i class="fa fa-link" aria-hidden="true"></i> <a href="javascript:modal.get('', '#viewExerciseModal','#requisicoes_ajax')">{{exercise.name}}</a></li> | ... | ... |
exercise/templatetags/list_topic_exercises.py
| ... | ... | @@ -5,21 +5,21 @@ register = template.Library() |
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | @register.inclusion_tag('exercise/exercise_list.html') |
| 8 | -def list_topic_exercise(request): | |
| 8 | +def list_topic_exercise(request, topic): | |
| 9 | 9 | context = { |
| 10 | 10 | 'request': request, |
| 11 | 11 | } |
| 12 | - context['exercises'] = Exercise.objects.all() | |
| 12 | + context['exercises'] = Exercise.objects.filter(topic=topic) | |
| 13 | 13 | |
| 14 | 14 | return context |
| 15 | 15 | |
| 16 | 16 | |
| 17 | 17 | @register.inclusion_tag('exercise/exercise_edit.html') |
| 18 | -def list_topic_exercise_edit(request, exercise): | |
| 18 | +def list_topic_exercise_edit(request, topic): | |
| 19 | 19 | context = { |
| 20 | 20 | 'request': request, |
| 21 | 21 | } |
| 22 | - context['exercises'] = Exercise.objects.all() | |
| 23 | - context['exercise'] = exercise | |
| 22 | + context['exercises'] = Exercise.objects.filter(topic = topic) | |
| 23 | + context['topic'] = topic | |
| 24 | 24 | |
| 25 | 25 | return context | ... | ... |
exercise/views.py
| 1 | 1 | from .forms import ExerciseForm, UpdateExerciseForm |
| 2 | 2 | from .models import Exercise |
| 3 | -from files.utils import mime_type_to_material_icons | |
| 4 | 3 | from core.decorators import log_decorator |
| 5 | 4 | from core.mixins import LogMixin, NotificationMixin |
| 6 | 5 | from core.models import Log, MimeType |
| ... | ... | @@ -13,8 +12,10 @@ from django.core.urlresolvers import reverse_lazy |
| 13 | 12 | from django.shortcuts import render, get_object_or_404, redirect |
| 14 | 13 | from django.urls import reverse |
| 15 | 14 | from django.views import generic |
| 15 | +from files.utils import mime_type_to_material_icons | |
| 16 | 16 | from rolepermissions.mixins import HasRoleMixin |
| 17 | 17 | from rolepermissions.verifications import has_role |
| 18 | +from users.models import User | |
| 18 | 19 | |
| 19 | 20 | |
| 20 | 21 | class CreateExercise(LoginRequiredMixin, HasRoleMixin, LogMixin, NotificationMixin, generic.CreateView): |
| ... | ... | @@ -23,7 +24,7 @@ class CreateExercise(LoginRequiredMixin, HasRoleMixin, LogMixin, NotificationMix |
| 23 | 24 | log_action = 'create' |
| 24 | 25 | log_component = {} |
| 25 | 26 | |
| 26 | - allowed_roles = ['student'] | |
| 27 | + allowed_roles = ['student', 'professor'] | |
| 27 | 28 | login_url = reverse_lazy("core:home") |
| 28 | 29 | redirect_field_name = 'next' |
| 29 | 30 | model = Exercise | ... | ... |
files/migrations/0001_initial.py
| 1 | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-16 13:57 | |
| 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 | |
| 3 | 3 | from __future__ import unicode_literals |
| 4 | 4 | |
| 5 | 5 | from django.db import migrations, models |
| ... | ... | @@ -12,8 +12,8 @@ class Migration(migrations.Migration): |
| 12 | 12 | initial = True |
| 13 | 13 | |
| 14 | 14 | dependencies = [ |
| 15 | - ('core', '0001_initial'), | |
| 16 | 15 | ('courses', '0001_initial'), |
| 16 | + ('core', '0001_initial'), | |
| 17 | 17 | ] |
| 18 | 18 | |
| 19 | 19 | operations = [ |
| ... | ... | @@ -26,9 +26,10 @@ class Migration(migrations.Migration): |
| 26 | 26 | ('file_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topic_files', to='core.MimeType', verbose_name='Type file')), |
| 27 | 27 | ], |
| 28 | 28 | options={ |
| 29 | + 'verbose_name': 'File', | |
| 30 | + | |
| 29 | 31 | 'verbose_name_plural': 'Files', |
| 30 | 32 | 'ordering': ('-id',), |
| 31 | - 'verbose_name': 'File', | |
| 32 | 33 | }, |
| 33 | 34 | bases=('courses.material',), |
| 34 | 35 | ), | ... | ... |
files/migrations/0002_topicfile_professor.py
| 1 | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-16 13:57 | |
| 2 | + | |
| 3 | +# Generated by Django 1.10 on 2016-11-15 22:36 | |
| 3 | 4 | from __future__ import unicode_literals |
| 4 | 5 | |
| 5 | 6 | from django.conf import settings |
| ... | ... | @@ -11,8 +12,8 @@ class Migration(migrations.Migration): |
| 11 | 12 | initial = True |
| 12 | 13 | |
| 13 | 14 | dependencies = [ |
| 14 | - ('files', '0001_initial'), | |
| 15 | 15 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), |
| 16 | + ('files', '0001_initial'), | |
| 16 | 17 | ] |
| 17 | 18 | |
| 18 | 19 | operations = [ | ... | ... |
forum/migrations/0001_initial.py
| 1 | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-16 13:57 | |
| 2 | + | |
| 3 | +# Generated by Django 1.10 on 2016-11-15 22:36 | |
| 3 | 4 | from __future__ import unicode_literals |
| 4 | 5 | |
| 5 | 6 | from django.db import migrations, models |
| ... | ... | @@ -24,8 +25,8 @@ class Migration(migrations.Migration): |
| 24 | 25 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Create Date')), |
| 25 | 26 | ], |
| 26 | 27 | options={ |
| 27 | - 'verbose_name_plural': 'Foruns', | |
| 28 | 28 | 'verbose_name': 'Forum', |
| 29 | + 'verbose_name_plural': 'Foruns', | |
| 29 | 30 | }, |
| 30 | 31 | bases=('courses.activity',), |
| 31 | 32 | ), |
| ... | ... | @@ -38,8 +39,8 @@ class Migration(migrations.Migration): |
| 38 | 39 | ('post_date', models.DateTimeField(auto_now_add=True, verbose_name='Post Date')), |
| 39 | 40 | ], |
| 40 | 41 | options={ |
| 41 | - 'verbose_name_plural': 'Posts', | |
| 42 | 42 | 'verbose_name': 'Post', |
| 43 | + 'verbose_name_plural': 'Posts', | |
| 43 | 44 | }, |
| 44 | 45 | ), |
| 45 | 46 | migrations.CreateModel( |
| ... | ... | @@ -52,8 +53,8 @@ class Migration(migrations.Migration): |
| 52 | 53 | ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Post', verbose_name='Post')), |
| 53 | 54 | ], |
| 54 | 55 | options={ |
| 55 | - 'verbose_name_plural': 'Post Answers', | |
| 56 | 56 | 'verbose_name': 'Post Answer', |
| 57 | + 'verbose_name_plural': 'Post Answers', | |
| 57 | 58 | }, |
| 58 | 59 | ), |
| 59 | 60 | ] | ... | ... |
| ... | ... | @@ -0,0 +1,35 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 | |
| 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/migrations/0002_auto_20161116_1057.py
| ... | ... | @@ -1,35 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -# Generated by Django 1.10 on 2016-11-16 13:57 | |
| 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 | - ] |
| ... | ... | @@ -0,0 +1,35 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
| 3 | +from __future__ import unicode_literals | |
| 4 | + | |
| 5 | +from django.conf import settings | |
| 6 | +from django.db import migrations, models | |
| 7 | +import django.db.models.deletion | |
| 8 | + | |
| 9 | + | |
| 10 | +class Migration(migrations.Migration): | |
| 11 | + | |
| 12 | + initial = True | |
| 13 | + | |
| 14 | + dependencies = [ | |
| 15 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
| 16 | + ('forum', '0001_initial'), | |
| 17 | + ] | |
| 18 | + | |
| 19 | + operations = [ | |
| 20 | + migrations.AddField( | |
| 21 | + model_name='postanswer', | |
| 22 | + name='user', | |
| 23 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor'), | |
| 24 | + ), | |
| 25 | + migrations.AddField( | |
| 26 | + model_name='post', | |
| 27 | + name='forum', | |
| 28 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Forum', verbose_name='Forum'), | |
| 29 | + ), | |
| 30 | + migrations.AddField( | |
| 31 | + model_name='post', | |
| 32 | + name='user', | |
| 33 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor'), | |
| 34 | + ), | |
| 35 | + ] | ... | ... |
links/migrations/0001_initial.py
| 1 | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-16 13:57 | |
| 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 | |
| 3 | 3 | from __future__ import unicode_literals |
| 4 | 4 | |
| 5 | 5 | from django.db import migrations, models |
| ... | ... | @@ -19,13 +19,13 @@ class Migration(migrations.Migration): |
| 19 | 19 | name='Link', |
| 20 | 20 | fields=[ |
| 21 | 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)), | |
| 22 | + ('link_url', models.URLField(verbose_name='Link_URL')), | |
| 23 | + ('link_description', models.CharField(max_length=200, verbose_name='Description')), | |
| 24 | 24 | ('image', models.ImageField(blank=True, upload_to='links/')), |
| 25 | 25 | ], |
| 26 | 26 | options={ |
| 27 | - 'verbose_name_plural': 'Links', | |
| 28 | 27 | 'verbose_name': 'Link', |
| 28 | + 'verbose_name_plural': 'Links', | |
| 29 | 29 | }, |
| 30 | 30 | bases=('courses.material',), |
| 31 | 31 | ), | ... | ... |
links/migrations/0002_auto_20161116_1338.py
| ... | ... | @@ -1,25 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -# Generated by Django 1.10 on 2016-11-16 16:38 | |
| 3 | -from __future__ import unicode_literals | |
| 4 | - | |
| 5 | -from django.db import migrations, models | |
| 6 | - | |
| 7 | - | |
| 8 | -class Migration(migrations.Migration): | |
| 9 | - | |
| 10 | - dependencies = [ | |
| 11 | - ('links', '0001_initial'), | |
| 12 | - ] | |
| 13 | - | |
| 14 | - operations = [ | |
| 15 | - migrations.AlterField( | |
| 16 | - model_name='link', | |
| 17 | - name='link_description', | |
| 18 | - field=models.TextField(verbose_name='Description'), | |
| 19 | - ), | |
| 20 | - migrations.AlterField( | |
| 21 | - model_name='link', | |
| 22 | - name='link_url', | |
| 23 | - field=models.URLField(verbose_name='Link_URL'), | |
| 24 | - ), | |
| 25 | - ] |
links/migrations/0003_auto_20161116_1340.py
| ... | ... | @@ -1,20 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -# Generated by Django 1.10 on 2016-11-16 16:40 | |
| 3 | -from __future__ import unicode_literals | |
| 4 | - | |
| 5 | -from django.db import migrations, models | |
| 6 | - | |
| 7 | - | |
| 8 | -class Migration(migrations.Migration): | |
| 9 | - | |
| 10 | - dependencies = [ | |
| 11 | - ('links', '0002_auto_20161116_1338'), | |
| 12 | - ] | |
| 13 | - | |
| 14 | - operations = [ | |
| 15 | - migrations.AlterField( | |
| 16 | - model_name='link', | |
| 17 | - name='link_description', | |
| 18 | - field=models.TextField(max_length=200, verbose_name='Description'), | |
| 19 | - ), | |
| 20 | - ] |
links/migrations/0004_auto_20161116_1341.py
| ... | ... | @@ -1,20 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -# Generated by Django 1.10 on 2016-11-16 16:41 | |
| 3 | -from __future__ import unicode_literals | |
| 4 | - | |
| 5 | -from django.db import migrations, models | |
| 6 | - | |
| 7 | - | |
| 8 | -class Migration(migrations.Migration): | |
| 9 | - | |
| 10 | - dependencies = [ | |
| 11 | - ('links', '0003_auto_20161116_1340'), | |
| 12 | - ] | |
| 13 | - | |
| 14 | - operations = [ | |
| 15 | - migrations.AlterField( | |
| 16 | - model_name='link', | |
| 17 | - name='link_description', | |
| 18 | - field=models.CharField(max_length=200, verbose_name='Description'), | |
| 19 | - ), | |
| 20 | - ] |
poll/migrations/0001_initial.py
| 1 | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-16 13:57 | |
| 2 | + | |
| 3 | +# Generated by Django 1.10 on 2016-11-15 22:36 | |
| 3 | 4 | from __future__ import unicode_literals |
| 4 | 5 | |
| 5 | 6 | from django.db import migrations, models |
| ... | ... | @@ -23,9 +24,9 @@ class Migration(migrations.Migration): |
| 23 | 24 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), |
| 24 | 25 | ], |
| 25 | 26 | options={ |
| 26 | - 'verbose_name_plural': 'Answers', | |
| 27 | - 'ordering': ('order',), | |
| 28 | 27 | 'verbose_name': 'Answer', |
| 28 | + 'ordering': ('order',), | |
| 29 | + 'verbose_name_plural': 'Answers', | |
| 29 | 30 | }, |
| 30 | 31 | ), |
| 31 | 32 | migrations.CreateModel( |
| ... | ... | @@ -37,8 +38,8 @@ class Migration(migrations.Migration): |
| 37 | 38 | ('answer', models.ManyToManyField(related_name='answers_stundet', to='poll.Answer', verbose_name='Answers Students')), |
| 38 | 39 | ], |
| 39 | 40 | options={ |
| 40 | - 'verbose_name_plural': 'Answers Student', | |
| 41 | 41 | 'verbose_name': 'Answer Stundent', |
| 42 | + 'verbose_name_plural': 'Answers Student', | |
| 42 | 43 | }, |
| 43 | 44 | ), |
| 44 | 45 | migrations.CreateModel( |
| ... | ... | @@ -47,8 +48,8 @@ class Migration(migrations.Migration): |
| 47 | 48 | ('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')), |
| 48 | 49 | ], |
| 49 | 50 | options={ |
| 50 | - 'verbose_name_plural': 'Polls', | |
| 51 | 51 | 'verbose_name': 'Poll', |
| 52 | + 'verbose_name_plural': 'Polls', | |
| 52 | 53 | }, |
| 53 | 54 | bases=('courses.activity',), |
| 54 | 55 | ), | ... | ... |
| ... | ... | @@ -0,0 +1,30 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 | |
| 3 | +from __future__ import unicode_literals | |
| 4 | + | |
| 5 | +from django.conf import settings | |
| 6 | +from django.db import migrations, models | |
| 7 | +import django.db.models.deletion | |
| 8 | + | |
| 9 | + | |
| 10 | +class Migration(migrations.Migration): | |
| 11 | + | |
| 12 | + initial = True | |
| 13 | + | |
| 14 | + dependencies = [ | |
| 15 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
| 16 | + ('poll', '0001_initial'), | |
| 17 | + ] | |
| 18 | + | |
| 19 | + operations = [ | |
| 20 | + migrations.AddField( | |
| 21 | + model_name='answersstudent', | |
| 22 | + name='student', | |
| 23 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers_stundent', to=settings.AUTH_USER_MODEL, verbose_name='Student'), | |
| 24 | + ), | |
| 25 | + migrations.AddField( | |
| 26 | + model_name='answer', | |
| 27 | + name='poll', | |
| 28 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='poll.Poll', verbose_name='Answers'), | |
| 29 | + ), | |
| 30 | + ] | ... | ... |
poll/migrations/0002_auto_20161116_1057.py
| ... | ... | @@ -1,30 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -# Generated by Django 1.10 on 2016-11-16 13:57 | |
| 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 | - ] |
| ... | ... | @@ -0,0 +1,30 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.10 on 2016-11-17 03:09 | |
| 3 | +from __future__ import unicode_literals | |
| 4 | + | |
| 5 | +from django.conf import settings | |
| 6 | +from django.db import migrations, models | |
| 7 | +import django.db.models.deletion | |
| 8 | + | |
| 9 | + | |
| 10 | +class Migration(migrations.Migration): | |
| 11 | + | |
| 12 | + initial = True | |
| 13 | + | |
| 14 | + dependencies = [ | |
| 15 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
| 16 | + ('poll', '0001_initial'), | |
| 17 | + ] | |
| 18 | + | |
| 19 | + operations = [ | |
| 20 | + migrations.AddField( | |
| 21 | + model_name='answersstudent', | |
| 22 | + name='student', | |
| 23 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers_stundent', to=settings.AUTH_USER_MODEL, verbose_name='Student'), | |
| 24 | + ), | |
| 25 | + migrations.AddField( | |
| 26 | + model_name='answer', | |
| 27 | + name='poll', | |
| 28 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='poll.Poll', verbose_name='Answers'), | |
| 29 | + ), | |
| 30 | + ] | ... | ... |
users/migrations/0001_initial.py
| 1 | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-16 13:57 | |
| 2 | + | |
| 3 | +# Generated by Django 1.10 on 2016-11-15 22:36 | |
| 3 | 4 | from __future__ import unicode_literals |
| 4 | 5 | |
| 5 | 6 | import django.contrib.auth.models |
| ... | ... | @@ -30,14 +31,14 @@ class Migration(migrations.Migration): |
| 30 | 31 | ('city', models.CharField(blank=True, max_length=90, verbose_name='City')), |
| 31 | 32 | ('state', models.CharField(blank=True, max_length=30, verbose_name='State')), |
| 32 | 33 | ('gender', models.CharField(choices=[('M', 'Male'), ('F', 'Female')], max_length=1, verbose_name='Gender')), |
| 33 | - ('image', models.ImageField(blank=True, null=True, upload_to='users/', verbose_name='Photo')), | |
| 34 | - ('birth_date', models.DateField(null=True, verbose_name='Birth Date')), | |
| 34 | + ('image', models.ImageField(blank=True, null=True, upload_to='users/', verbose_name='Image')), | |
| 35 | + ('birth_date', models.DateField(verbose_name='Birth Date')), | |
| 35 | 36 | ('phone', models.CharField(blank=True, max_length=30, verbose_name='Phone')), |
| 36 | - ('cpf', models.CharField(blank=True, max_length=15, null=True, verbose_name='CPF')), | |
| 37 | + ('cpf', models.CharField(max_length=15, verbose_name='Cpf')), | |
| 37 | 38 | ('type_profile', models.IntegerField(blank=True, choices=[(1, 'Professor'), (2, 'Student')], default=2, null=True, verbose_name='Type')), |
| 38 | 39 | ('titration', models.CharField(blank=True, max_length=50, null=True, verbose_name='Titration')), |
| 39 | 40 | ('year_titration', models.CharField(blank=True, max_length=4, null=True, verbose_name='Year of titration')), |
| 40 | - ('institution', models.CharField(blank=True, max_length=50, null=True, verbose_name='Institution')), | |
| 41 | + ('institution', models.CharField(blank=True, max_length=50, null=True, verbose_name='Institution where he had titration')), | |
| 41 | 42 | ('curriculum', models.FileField(blank=True, null=True, upload_to='users/curriculum/', verbose_name='Curriculum')), |
| 42 | 43 | ('date_created', models.DateTimeField(auto_now_add=True, verbose_name='Create Date')), |
| 43 | 44 | ('is_staff', models.BooleanField(default=False, verbose_name='Administrador')), |
| ... | ... | @@ -46,8 +47,8 @@ class Migration(migrations.Migration): |
| 46 | 47 | ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), |
| 47 | 48 | ], |
| 48 | 49 | options={ |
| 49 | - 'verbose_name_plural': 'Users', | |
| 50 | 50 | 'verbose_name': 'User', |
| 51 | + 'verbose_name_plural': 'Users', | |
| 51 | 52 | }, |
| 52 | 53 | managers=[ |
| 53 | 54 | ('objects', django.contrib.auth.models.UserManager()), | ... | ... |
| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.10 on 2016-11-15 22:41 | |
| 3 | +from __future__ import unicode_literals | |
| 4 | + | |
| 5 | +from django.db import migrations, models | |
| 6 | + | |
| 7 | + | |
| 8 | +class Migration(migrations.Migration): | |
| 9 | + | |
| 10 | + dependencies = [ | |
| 11 | + ('users', '0001_initial'), | |
| 12 | + ] | |
| 13 | + | |
| 14 | + operations = [ | |
| 15 | + migrations.AlterField( | |
| 16 | + model_name='user', | |
| 17 | + name='birth_date', | |
| 18 | + field=models.DateField(null=True, verbose_name='Birth Date'), | |
| 19 | + ), | |
| 20 | + ] | ... | ... |
| ... | ... | @@ -0,0 +1,30 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.10 on 2016-11-15 23:54 | |
| 3 | +from __future__ import unicode_literals | |
| 4 | + | |
| 5 | +from django.db import migrations, models | |
| 6 | + | |
| 7 | + | |
| 8 | +class Migration(migrations.Migration): | |
| 9 | + | |
| 10 | + dependencies = [ | |
| 11 | + ('users', '0002_auto_20161115_1941'), | |
| 12 | + ] | |
| 13 | + | |
| 14 | + operations = [ | |
| 15 | + migrations.AlterField( | |
| 16 | + model_name='user', | |
| 17 | + name='cpf', | |
| 18 | + field=models.CharField(blank=True, max_length=15, null=True, verbose_name='CPF'), | |
| 19 | + ), | |
| 20 | + migrations.AlterField( | |
| 21 | + model_name='user', | |
| 22 | + name='image', | |
| 23 | + field=models.ImageField(blank=True, null=True, upload_to='users/', verbose_name='Photo'), | |
| 24 | + ), | |
| 25 | + migrations.AlterField( | |
| 26 | + model_name='user', | |
| 27 | + name='institution', | |
| 28 | + field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Institution'), | |
| 29 | + ), | |
| 30 | + ] | ... | ... |