Commit 3cce91699295fdc7a573682b30a9452026e59eda
Exists in
master
and in
5 other branches
Update form #7
Showing
25 changed files
with
228 additions
and
291 deletions
Show diff stats
amadeus/settings.py
core/templates/base.html
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | 8 | ||
9 | <meta http-equiv="Cache-Control" content="no-cache, no-store" /> | 9 | <meta http-equiv="Cache-Control" content="no-cache, no-store" /> |
10 | <link href="{% static 'img/favicon.ico' %}" rel="shortcut icon" /> | 10 | <link href="{% static 'img/favicon.ico' %}" rel="shortcut icon" /> |
11 | - | 11 | + |
12 | <!-- Roboto font --> | 12 | <!-- Roboto font --> |
13 | <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,500,700" type="text/css"> | 13 | <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,500,700" type="text/css"> |
14 | <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> | 14 | <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> |
@@ -18,11 +18,11 @@ | @@ -18,11 +18,11 @@ | ||
18 | <script type="text/javascript" src="{% static 'js/vendor/jquery-ui.js' %}"></script> | 18 | <script type="text/javascript" src="{% static 'js/vendor/jquery-ui.js' %}"></script> |
19 | 19 | ||
20 | <!-- Bootstrap and themes (material) --> | 20 | <!-- Bootstrap and themes (material) --> |
21 | - <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/bootstrap.min.css' %}"> | 21 | + <link rel="stylesheet" type="text/css" href="{% static 'bootstrap-3.3.7/css/bootstrap.css' %}"> |
22 | <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/material.min.css' %}"> | 22 | <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/material.min.css' %}"> |
23 | <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/ripples.min.css' %}"> | 23 | <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/ripples.min.css' %}"> |
24 | - <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/datepicker.css' %}"> | ||
25 | - <script type="text/javascript" src="{% static 'js/vendor/bootstrap.min.js' %}"></script> | 24 | + <link rel="stylesheet" type="text/css" href="{% static 'css/datepicker.css' %}"> |
25 | + <script type="text/javascript" src="{% static 'bootstrap-3.3.7/js/bootstrap.js' %}"></script> | ||
26 | <script type="text/javascript" src="{% static 'js/vendor/bootstrap-acessibility.min.js' %}"></script> | 26 | <script type="text/javascript" src="{% static 'js/vendor/bootstrap-acessibility.min.js' %}"></script> |
27 | <script type="text/javascript" src="{% static 'js/vendor/material.min.js' %}"></script> | 27 | <script type="text/javascript" src="{% static 'js/vendor/material.min.js' %}"></script> |
28 | <script type="text/javascript" src="{% static 'js/vendor/ripples.min.js' %}"></script> | 28 | <script type="text/javascript" src="{% static 'js/vendor/ripples.min.js' %}"></script> |
@@ -142,8 +142,6 @@ | @@ -142,8 +142,6 @@ | ||
142 | </div> | 142 | </div> |
143 | </div> | 143 | </div> |
144 | </div> | 144 | </div> |
145 | - | ||
146 | - | ||
147 | </div> | 145 | </div> |
148 | </div> | 146 | </div> |
149 | </body> | 147 | </body> |
courses/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-09-22 05:46 | 2 | +# Generated by Django 1.10 on 2016-09-28 20:27 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | import autoslug.fields | 5 | import autoslug.fields |
@@ -22,7 +22,6 @@ class Migration(migrations.Migration): | @@ -22,7 +22,6 @@ class Migration(migrations.Migration): | ||
22 | name='Activity', | 22 | name='Activity', |
23 | fields=[ | 23 | fields=[ |
24 | ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), | 24 | ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), |
25 | - ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), | ||
26 | ('limit_date', models.DateTimeField(verbose_name='Deliver Date')), | 25 | ('limit_date', models.DateTimeField(verbose_name='Deliver Date')), |
27 | ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='student')), | 26 | ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='student')), |
28 | ], | 27 | ], |
@@ -37,8 +36,8 @@ class Migration(migrations.Migration): | @@ -37,8 +36,8 @@ class Migration(migrations.Migration): | ||
37 | ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), | 36 | ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), |
38 | ], | 37 | ], |
39 | options={ | 38 | options={ |
40 | - 'verbose_name_plural': 'Categories', | ||
41 | 'verbose_name': 'Category', | 39 | 'verbose_name': 'Category', |
40 | + 'verbose_name_plural': 'Categories', | ||
42 | }, | 41 | }, |
43 | ), | 42 | ), |
44 | migrations.CreateModel( | 43 | migrations.CreateModel( |
@@ -57,20 +56,19 @@ class Migration(migrations.Migration): | @@ -57,20 +56,19 @@ class Migration(migrations.Migration): | ||
57 | ('end_date', models.DateField(verbose_name='End of Course Date')), | 56 | ('end_date', models.DateField(verbose_name='End of Course Date')), |
58 | ('image', models.ImageField(blank=True, upload_to='courses/', verbose_name='Image')), | 57 | ('image', models.ImageField(blank=True, upload_to='courses/', verbose_name='Image')), |
59 | ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Category', verbose_name='Category')), | 58 | ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Category', verbose_name='Category')), |
60 | - ('professors', models.ManyToManyField(related_name='courses', to=settings.AUTH_USER_MODEL, verbose_name='Professors')), | 59 | + ('professors', models.ManyToManyField(related_name='courses_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors')), |
61 | ('students', models.ManyToManyField(related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students')), | 60 | ('students', models.ManyToManyField(related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students')), |
62 | ], | 61 | ], |
63 | options={ | 62 | options={ |
63 | + 'verbose_name': 'Course', | ||
64 | 'verbose_name_plural': 'Courses', | 64 | 'verbose_name_plural': 'Courses', |
65 | 'ordering': ('create_date', 'name'), | 65 | 'ordering': ('create_date', 'name'), |
66 | - 'verbose_name': 'Course', | ||
67 | }, | 66 | }, |
68 | ), | 67 | ), |
69 | migrations.CreateModel( | 68 | migrations.CreateModel( |
70 | name='Material', | 69 | name='Material', |
71 | fields=[ | 70 | fields=[ |
72 | ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), | 71 | ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), |
73 | - ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), | ||
74 | ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='student')), | 72 | ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='student')), |
75 | ], | 73 | ], |
76 | bases=('core.resource',), | 74 | bases=('core.resource',), |
@@ -91,9 +89,23 @@ class Migration(migrations.Migration): | @@ -91,9 +89,23 @@ class Migration(migrations.Migration): | ||
91 | ('professors', models.ManyToManyField(related_name='subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors')), | 89 | ('professors', models.ManyToManyField(related_name='subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors')), |
92 | ], | 90 | ], |
93 | options={ | 91 | options={ |
92 | + 'verbose_name': 'Subject', | ||
94 | 'verbose_name_plural': 'Subjects', | 93 | 'verbose_name_plural': 'Subjects', |
95 | 'ordering': ('create_date', 'name'), | 94 | 'ordering': ('create_date', 'name'), |
96 | - 'verbose_name': 'Subject', | 95 | + }, |
96 | + ), | ||
97 | + migrations.CreateModel( | ||
98 | + name='SubjectCategory', | ||
99 | + fields=[ | ||
100 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
101 | + ('name', models.CharField(max_length=100, verbose_name='Name')), | ||
102 | + ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), | ||
103 | + ('description', models.TextField(blank=True, verbose_name='Description')), | ||
104 | + ('subjects', models.ManyToManyField(to='courses.Subject')), | ||
105 | + ], | ||
106 | + options={ | ||
107 | + 'verbose_name': 'subject category', | ||
108 | + 'verbose_name_plural': 'subject categories', | ||
97 | }, | 109 | }, |
98 | ), | 110 | ), |
99 | migrations.CreateModel( | 111 | migrations.CreateModel( |
@@ -110,9 +122,9 @@ class Migration(migrations.Migration): | @@ -110,9 +122,9 @@ class Migration(migrations.Migration): | ||
110 | ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject')), | 122 | ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject')), |
111 | ], | 123 | ], |
112 | options={ | 124 | options={ |
125 | + 'verbose_name': 'Topic', | ||
113 | 'verbose_name_plural': 'Topics', | 126 | 'verbose_name_plural': 'Topics', |
114 | 'ordering': ('create_date', 'name'), | 127 | 'ordering': ('create_date', 'name'), |
115 | - 'verbose_name': 'Topic', | ||
116 | }, | 128 | }, |
117 | ), | 129 | ), |
118 | migrations.AddField( | 130 | migrations.AddField( |
courses/migrations/0002_auto_20160926_0026.py
@@ -1,38 +0,0 @@ | @@ -1,38 +0,0 @@ | ||
1 | -# -*- coding: utf-8 -*- | ||
2 | -# Generated by Django 1.10 on 2016-09-26 03:26 | ||
3 | -from __future__ import unicode_literals | ||
4 | - | ||
5 | -import autoslug.fields | ||
6 | -from django.db import migrations, models | ||
7 | - | ||
8 | - | ||
9 | -class Migration(migrations.Migration): | ||
10 | - | ||
11 | - dependencies = [ | ||
12 | - ('courses', '0001_initial'), | ||
13 | - ] | ||
14 | - | ||
15 | - operations = [ | ||
16 | - migrations.CreateModel( | ||
17 | - name='SubjectCategory', | ||
18 | - fields=[ | ||
19 | - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
20 | - ('name', models.CharField(max_length=100, verbose_name='Name')), | ||
21 | - ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), | ||
22 | - ('description', models.TextField(blank=True, verbose_name='Description')), | ||
23 | - ('subjects', models.ManyToManyField(to='courses.Subject')), | ||
24 | - ], | ||
25 | - options={ | ||
26 | - 'verbose_name_plural': 'subject categories', | ||
27 | - 'verbose_name': 'subject category', | ||
28 | - }, | ||
29 | - ), | ||
30 | - migrations.RemoveField( | ||
31 | - model_name='activity', | ||
32 | - name='create_date', | ||
33 | - ), | ||
34 | - migrations.RemoveField( | ||
35 | - model_name='material', | ||
36 | - name='create_date', | ||
37 | - ), | ||
38 | - ] |
courses/migrations/0003_auto_20160927_1945.py
@@ -1,52 +0,0 @@ | @@ -1,52 +0,0 @@ | ||
1 | -# -*- coding: utf-8 -*- | ||
2 | -# Generated by Django 1.10 on 2016-09-27 22:45 | ||
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 | - dependencies = [ | ||
13 | - ('courses', '0002_auto_20160926_0026'), | ||
14 | - ] | ||
15 | - | ||
16 | - operations = [ | ||
17 | - migrations.CreateModel( | ||
18 | - name='Answer', | ||
19 | - fields=[ | ||
20 | - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
21 | - ('answer', models.CharField(max_length=200, verbose_name='Answer')), | ||
22 | - ('order', models.PositiveSmallIntegerField(verbose_name='Order')), | ||
23 | - ], | ||
24 | - options={ | ||
25 | - 'verbose_name_plural': 'Answers', | ||
26 | - 'verbose_name': 'Answer', | ||
27 | - 'ordering': ('order',), | ||
28 | - }, | ||
29 | - ), | ||
30 | - migrations.CreateModel( | ||
31 | - name='Poll', | ||
32 | - fields=[ | ||
33 | - ('activity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='courses.Activity')), | ||
34 | - ('question', models.CharField(max_length=300, verbose_name='Question')), | ||
35 | - ], | ||
36 | - options={ | ||
37 | - 'verbose_name_plural': 'Polls', | ||
38 | - 'verbose_name': 'Poll', | ||
39 | - }, | ||
40 | - bases=('courses.activity',), | ||
41 | - ), | ||
42 | - migrations.AlterField( | ||
43 | - model_name='course', | ||
44 | - name='professors', | ||
45 | - field=models.ManyToManyField(related_name='courses_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | ||
46 | - ), | ||
47 | - migrations.AddField( | ||
48 | - model_name='answer', | ||
49 | - name='poll', | ||
50 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='courses.Poll', verbose_name='Answers'), | ||
51 | - ), | ||
52 | - ] |
courses/models.py
@@ -105,35 +105,11 @@ It is a category for each subject. | @@ -105,35 +105,11 @@ It is a category for each subject. | ||
105 | """ | 105 | """ |
106 | class SubjectCategory(models.Model): | 106 | class SubjectCategory(models.Model): |
107 | name = models.CharField(_('Name'), max_length= 100) | 107 | name = models.CharField(_('Name'), max_length= 100) |
108 | - slug = AutoSlugField(_("Slug"),populate_from='name',unique=True) | 108 | + slug = AutoSlugField(_("Slug"),populate_from='name',unique=True) |
109 | description = models.TextField(_('Description'), blank = True) | 109 | description = models.TextField(_('Description'), blank = True) |
110 | subjects = models.ManyToManyField(Subject) | 110 | subjects = models.ManyToManyField(Subject) |
111 | 111 | ||
112 | class Meta: | 112 | class Meta: |
113 | verbose_name = _('subject category') | 113 | verbose_name = _('subject category') |
114 | verbose_name_plural = _('subject categories') | 114 | verbose_name_plural = _('subject categories') |
115 | - | ||
116 | -class Poll(Activity): | ||
117 | - question = models.CharField(_('Question'), max_length = 300) | ||
118 | - | ||
119 | - class Meta: | ||
120 | - #ordering = ('create_date','name') | ||
121 | - verbose_name = _('Poll') | ||
122 | - verbose_name_plural = _('Polls') | ||
123 | - | ||
124 | - def __str__(self): | ||
125 | - return str(self.question) + str("/") + str(self.topic) | ||
126 | - | ||
127 | -class Answer(models.Model): | ||
128 | - answer = models.CharField(_("Answer"), max_length = 200) | ||
129 | - order = models.PositiveSmallIntegerField(_("Order")) | ||
130 | - poll = models.ForeignKey(Poll, verbose_name = _('Answers'), related_name='answers') | ||
131 | - | ||
132 | - class Meta: | ||
133 | - ordering = ('order',) | ||
134 | - verbose_name = _('Answer') | ||
135 | - verbose_name_plural = _('Answers') | ||
136 | - | ||
137 | - def __str__(self): | ||
138 | - return str(self.question) + str("/") + str(self.topic) | ||
139 | - | 115 | + |
courses/templates/poll/poll.html
@@ -1,53 +0,0 @@ | @@ -1,53 +0,0 @@ | ||
1 | -{% extends "topic/index.html" %} | ||
2 | - | ||
3 | -{% load i18n %} | ||
4 | - | ||
5 | -{% block style %} | ||
6 | - <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> | ||
7 | -{% endblock %} | ||
8 | - | ||
9 | -{% block content %} | ||
10 | -<div class="col-md-8 col-md-offset-2"> | ||
11 | - <div class="panel panel-primary"> | ||
12 | - <div class="panel-heading"> | ||
13 | - <h3 class="panel-title"> | ||
14 | - <span class="glyphicon glyphicon-hand-right"></span> Question?</h3> | ||
15 | - </div> | ||
16 | - <div class="container-fluid"> | ||
17 | - <form id="form" class="" action="" method="post"> | ||
18 | - <div class="row form-group"> | ||
19 | - <div class="col-md-1"> | ||
20 | - </br> | ||
21 | - <label><span class="glyphicon glyphicon-menu-hamburger"></span></label> | ||
22 | - </div> | ||
23 | - <div class="col-md-10"> | ||
24 | - <div class="form-control-md has-success is-empty"> | ||
25 | - <input type="text" class="form-control" placeholder="Email address default size"> | ||
26 | - <span class="help-block">Please enter a valid email address</span> | ||
27 | - </div> | ||
28 | - </div> | ||
29 | - <div class="col-md-1"> | ||
30 | - </br> | ||
31 | - <label><span class="glyphicon glyphicon-remove" onclick="this.parentNode.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode.parentNode);"></span></label> | ||
32 | - </div> | ||
33 | - </div> | ||
34 | - </form> | ||
35 | - </br> | ||
36 | - </div> | ||
37 | - | ||
38 | - </div> | ||
39 | - <div class="panel-footer text-center"> | ||
40 | - <button type="button" id="add" class="btn btn-primary btn-block btn-sm">add</button> | ||
41 | - <a href="#" class="small">View Result</a> | ||
42 | - </div> | ||
43 | - </div> | ||
44 | -<script type="text/javascript"> | ||
45 | -$( "#form" ).sortable({ | ||
46 | - delay: 100, | ||
47 | - distance: 5, | ||
48 | -}); | ||
49 | -$("#add").click(function() { | ||
50 | - $("#form").append('<div class="row form-group"><div class="col-md-1"></br><label><span class="glyphicon glyphicon-menu-hamburger"></span></label></div><div class="col-md-10"><div class="form-group-md has-success is-empty"><input type="text" class="form-control" placeholder="Email address default size"><span class="help-block">Please enter a valid email address</span></div></div><div class="col-md-1"></br><label><span class="glyphicon glyphicon-remove" onclick="this.parentNode.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode.parentNode);"></span></label></div></br></div>'); | ||
51 | -}); | ||
52 | -</script> | ||
53 | -{% endblock content %} |
courses/urls.py
1 | -from django.conf.urls import url | 1 | +from django.conf.urls import url, include |
2 | 2 | ||
3 | from . import views | 3 | from . import views |
4 | 4 | ||
@@ -22,6 +22,8 @@ urlpatterns = [ | @@ -22,6 +22,8 @@ urlpatterns = [ | ||
22 | url(r'^topics/update/(?P<slug>[\w_-]+)/$', views.UpdateTopicView.as_view(), name='update_topic'), | 22 | url(r'^topics/update/(?P<slug>[\w_-]+)/$', views.UpdateTopicView.as_view(), name='update_topic'), |
23 | url(r'^topics/(?P<slug>[\w_-]+)/$', views.TopicsView.as_view(), name='view_topic'), | 23 | url(r'^topics/(?P<slug>[\w_-]+)/$', views.TopicsView.as_view(), name='view_topic'), |
24 | url(r'^subjects/categories$',views.IndexSubjectCategoryView.as_view(), name='subject_category_index'), | 24 | url(r'^subjects/categories$',views.IndexSubjectCategoryView.as_view(), name='subject_category_index'), |
25 | - url(r'^to/poll/to/$', views.Poll.as_view(), name='poll'), | 25 | + |
26 | + | ||
27 | + url(r'^poll/', include('poll.urls', namespace = 'poll')) | ||
26 | 28 | ||
27 | ] | 29 | ] |
courses/views.py
@@ -455,27 +455,3 @@ class IndexSubjectCategoryView(LoginRequiredMixin, generic.ListView): | @@ -455,27 +455,3 @@ class IndexSubjectCategoryView(LoginRequiredMixin, generic.ListView): | ||
455 | context = super(IndexSubjectCategoryView, self).get_context_data(**kwargs) | 455 | context = super(IndexSubjectCategoryView, self).get_context_data(**kwargs) |
456 | context['subject_categories'] = SubjectCategory.objects.all() | 456 | context['subject_categories'] = SubjectCategory.objects.all() |
457 | return context | 457 | return context |
458 | - | ||
459 | - | ||
460 | -class Poll(generic.TemplateView): | ||
461 | - | ||
462 | - # login_url = reverse_lazy("core:home") | ||
463 | - # redirect_field_name = 'next' | ||
464 | - # model = Course | ||
465 | - # context_object_name = 'course' | ||
466 | - template_name = 'poll/poll.html' | ||
467 | - # queryset = Course.objects.all() | ||
468 | - | ||
469 | - # def get_queryset(self): | ||
470 | - # return Course.objects.all()[0] | ||
471 | - | ||
472 | - def get_context_data(self, **kwargs): | ||
473 | - context = super(Poll, self).get_context_data(**kwargs) | ||
474 | - course = Course.objects.all()[0] | ||
475 | - context['course'] = course | ||
476 | - context['subject'] = course.subjects.all()[0] | ||
477 | - context['subjects'] = course.subjects.all() | ||
478 | - # if (has_role(self.request.user,'system_admin')): | ||
479 | - # context['subjects'] = self.object.course.subjects.all() | ||
480 | - return context | ||
481 | - |
forum/migrations/0001_initial.py
1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-09-22 20:41 | 2 | +# Generated by Django 1.10 on 2016-09-28 20:27 |
3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
4 | 4 | ||
5 | from django.conf import settings | 5 | from django.conf import settings |
@@ -21,8 +21,9 @@ class Migration(migrations.Migration): | @@ -21,8 +21,9 @@ class Migration(migrations.Migration): | ||
21 | name='Forum', | 21 | name='Forum', |
22 | fields=[ | 22 | fields=[ |
23 | ('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')), | 23 | ('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')), |
24 | - ('title', models.CharField(max_length=100, verbose_name='Title')), | ||
25 | ('description', models.TextField(blank=True, verbose_name='Description')), | 24 | ('description', models.TextField(blank=True, verbose_name='Description')), |
25 | + ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), | ||
26 | + ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Create Date')), | ||
26 | ], | 27 | ], |
27 | options={ | 28 | options={ |
28 | 'verbose_name': 'Forum', | 29 | 'verbose_name': 'Forum', |
@@ -35,6 +36,7 @@ class Migration(migrations.Migration): | @@ -35,6 +36,7 @@ class Migration(migrations.Migration): | ||
35 | fields=[ | 36 | fields=[ |
36 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | 37 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
37 | ('message', models.TextField(verbose_name='Post message')), | 38 | ('message', models.TextField(verbose_name='Post message')), |
39 | + ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), | ||
38 | ('post_date', models.DateTimeField(auto_now_add=True, verbose_name='Post Date')), | 40 | ('post_date', models.DateTimeField(auto_now_add=True, verbose_name='Post Date')), |
39 | ('forum', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Forum', verbose_name='Forum')), | 41 | ('forum', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Forum', verbose_name='Forum')), |
40 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor')), | 42 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor')), |
@@ -49,6 +51,7 @@ class Migration(migrations.Migration): | @@ -49,6 +51,7 @@ class Migration(migrations.Migration): | ||
49 | fields=[ | 51 | fields=[ |
50 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | 52 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
51 | ('message', models.TextField(verbose_name='Answer message')), | 53 | ('message', models.TextField(verbose_name='Answer message')), |
54 | + ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), | ||
52 | ('answer_date', models.DateTimeField(auto_now_add=True, verbose_name='Answer Date')), | 55 | ('answer_date', models.DateTimeField(auto_now_add=True, verbose_name='Answer Date')), |
53 | ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Post', verbose_name='Post')), | 56 | ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Post', verbose_name='Post')), |
54 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor')), | 57 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor')), |
forum/migrations/0002_remove_forum_title.py
@@ -1,19 +0,0 @@ | @@ -1,19 +0,0 @@ | ||
1 | -# -*- coding: utf-8 -*- | ||
2 | -# Generated by Django 1.10 on 2016-09-22 20:43 | ||
3 | -from __future__ import unicode_literals | ||
4 | - | ||
5 | -from django.db import migrations | ||
6 | - | ||
7 | - | ||
8 | -class Migration(migrations.Migration): | ||
9 | - | ||
10 | - dependencies = [ | ||
11 | - ('forum', '0001_initial'), | ||
12 | - ] | ||
13 | - | ||
14 | - operations = [ | ||
15 | - migrations.RemoveField( | ||
16 | - model_name='forum', | ||
17 | - name='title', | ||
18 | - ), | ||
19 | - ] |
forum/migrations/0003_forum_create_date.py
@@ -1,22 +0,0 @@ | @@ -1,22 +0,0 @@ | ||
1 | -# -*- coding: utf-8 -*- | ||
2 | -# Generated by Django 1.10 on 2016-09-28 02:17 | ||
3 | -from __future__ import unicode_literals | ||
4 | - | ||
5 | -from django.db import migrations, models | ||
6 | -import django.utils.timezone | ||
7 | - | ||
8 | - | ||
9 | -class Migration(migrations.Migration): | ||
10 | - | ||
11 | - dependencies = [ | ||
12 | - ('forum', '0002_remove_forum_title'), | ||
13 | - ] | ||
14 | - | ||
15 | - operations = [ | ||
16 | - migrations.AddField( | ||
17 | - model_name='forum', | ||
18 | - name='create_date', | ||
19 | - field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now, verbose_name='Create Date'), | ||
20 | - preserve_default=False, | ||
21 | - ), | ||
22 | - ] |
forum/migrations/0004_auto_20160928_1558.py
@@ -1,30 +0,0 @@ | @@ -1,30 +0,0 @@ | ||
1 | -# -*- coding: utf-8 -*- | ||
2 | -# Generated by Django 1.10 on 2016-09-28 18:58 | ||
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 | - ('forum', '0003_forum_create_date'), | ||
12 | - ] | ||
13 | - | ||
14 | - operations = [ | ||
15 | - migrations.AddField( | ||
16 | - model_name='forum', | ||
17 | - name='modification_date', | ||
18 | - field=models.DateTimeField(auto_now=True, verbose_name='Modification Date'), | ||
19 | - ), | ||
20 | - migrations.AddField( | ||
21 | - model_name='post', | ||
22 | - name='modification_date', | ||
23 | - field=models.DateTimeField(auto_now=True, verbose_name='Modification Date'), | ||
24 | - ), | ||
25 | - migrations.AddField( | ||
26 | - model_name='postanswer', | ||
27 | - name='modification_date', | ||
28 | - field=models.DateTimeField(auto_now=True, verbose_name='Modification Date'), | ||
29 | - ), | ||
30 | - ] |
@@ -0,0 +1,48 @@ | @@ -0,0 +1,48 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-09-28 20:27 | ||
3 | +from __future__ import unicode_literals | ||
4 | + | ||
5 | +from django.db import migrations, models | ||
6 | +import django.db.models.deletion | ||
7 | + | ||
8 | + | ||
9 | +class Migration(migrations.Migration): | ||
10 | + | ||
11 | + initial = True | ||
12 | + | ||
13 | + dependencies = [ | ||
14 | + ('courses', '0001_initial'), | ||
15 | + ] | ||
16 | + | ||
17 | + operations = [ | ||
18 | + migrations.CreateModel( | ||
19 | + name='Answer', | ||
20 | + fields=[ | ||
21 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
22 | + ('answer', models.CharField(max_length=200, verbose_name='Answer')), | ||
23 | + ('order', models.PositiveSmallIntegerField(verbose_name='Order')), | ||
24 | + ], | ||
25 | + options={ | ||
26 | + 'verbose_name': 'Answer', | ||
27 | + 'verbose_name_plural': 'Answers', | ||
28 | + 'ordering': ('order',), | ||
29 | + }, | ||
30 | + ), | ||
31 | + migrations.CreateModel( | ||
32 | + name='Poll', | ||
33 | + fields=[ | ||
34 | + ('activity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='courses.Activity')), | ||
35 | + ('question', models.CharField(max_length=300, verbose_name='Question')), | ||
36 | + ], | ||
37 | + options={ | ||
38 | + 'verbose_name': 'Poll', | ||
39 | + 'verbose_name_plural': 'Polls', | ||
40 | + }, | ||
41 | + bases=('courses.activity',), | ||
42 | + ), | ||
43 | + migrations.AddField( | ||
44 | + model_name='answer', | ||
45 | + name='poll', | ||
46 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='poll.Poll', verbose_name='Answers'), | ||
47 | + ), | ||
48 | + ] |
@@ -0,0 +1,30 @@ | @@ -0,0 +1,30 @@ | ||
1 | +from django.utils.translation import ugettext_lazy as _ | ||
2 | +from django.db import models | ||
3 | +from autoslug.fields import AutoSlugField | ||
4 | +from users.models import User | ||
5 | +from core.models import Resource | ||
6 | +from courses.models import Activity | ||
7 | + | ||
8 | +class Poll(Activity): | ||
9 | + question = models.CharField(_('Question'), max_length = 300) | ||
10 | + | ||
11 | + class Meta: | ||
12 | + #ordering = ('create_date','name') | ||
13 | + verbose_name = _('Poll') | ||
14 | + verbose_name_plural = _('Polls') | ||
15 | + | ||
16 | + def __str__(self): | ||
17 | + return str(self.question) + str("/") + str(self.topic) | ||
18 | + | ||
19 | +class Answer(models.Model): | ||
20 | + answer = models.CharField(_("Answer"), max_length = 200) | ||
21 | + order = models.PositiveSmallIntegerField(_("Order")) | ||
22 | + poll = models.ForeignKey(Poll, verbose_name = _('Answers'), related_name='answers') | ||
23 | + | ||
24 | + class Meta: | ||
25 | + ordering = ('order',) | ||
26 | + verbose_name = _('Answer') | ||
27 | + verbose_name_plural = _('Answers') | ||
28 | + | ||
29 | + def __str__(self): | ||
30 | + return str(self.question) + str("/") + str(self.topic) |
@@ -0,0 +1,52 @@ | @@ -0,0 +1,52 @@ | ||
1 | +{% extends "topic/index.html" %} | ||
2 | + | ||
3 | +{% load i18n %} | ||
4 | + | ||
5 | +{% block style %} | ||
6 | + <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> | ||
7 | +{% endblock %} | ||
8 | + | ||
9 | +{% block content %} | ||
10 | +<div class="col-md-8 col-md-offset-2"> | ||
11 | + <div class="panel panel-primary"> | ||
12 | + <div class="panel-heading"> | ||
13 | + <h3 class="panel-title"> | ||
14 | + <span class="glyphicon glyphicon-hand-right"></span> Question?</h3> | ||
15 | + </div> | ||
16 | + <div class="container-fluid"> | ||
17 | + <form id="form" class="" action="" method="post"> | ||
18 | + <div class="row form-group"> | ||
19 | + <div class="col-md-1"> | ||
20 | + </br> | ||
21 | + <label><a href=""><span class="glyphicon glyphicon-move"></span></a></label> | ||
22 | + </div> | ||
23 | + <div class="col-md-10"> | ||
24 | + <div class="form-control-md has-success is-empty"> | ||
25 | + <input type="text" class="form-control" placeholder="Email address default size"> | ||
26 | + <span class="help-block">{% trans "Possible Answer" %}</span> | ||
27 | + </div> | ||
28 | + </div> | ||
29 | + <div class="col-md-1"> | ||
30 | + </br> | ||
31 | + <label><a href=""><span class="glyphicon glyphicon-remove" onclick="this.parentNode.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode.parentNode);"></span></a></label> | ||
32 | + </div> | ||
33 | + </div> | ||
34 | + </form> | ||
35 | + </br> | ||
36 | + </div> | ||
37 | + | ||
38 | + </div> | ||
39 | + <div class="panel-footer text-center"> | ||
40 | + <button type="button" id="add" class="btn btn-primary btn-block btn-sm">add</button> | ||
41 | + </div> | ||
42 | + </div> | ||
43 | +<script type="text/javascript"> | ||
44 | +$( "#form" ).sortable({ | ||
45 | + delay: 100, | ||
46 | + distance: 5, | ||
47 | +}); | ||
48 | +$("#add").click(function() { | ||
49 | + $("#form").append('<div class="row form-group"><div class="col-md-1"></br><label><a href=""><span class="glyphicon glyphicon-move"></span></a></label></div><div class="col-md-10"><div class="form-group-md has-success is-empty"><input type="text" class="form-control" placeholder="Email address default size"><span class="help-block">Please enter a valid email address</span></div></div><div class="col-md-1"></br><label><a href=""><span class="glyphicon glyphicon-remove" onclick="this.parentNode.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode.parentNode);"></span></a></label></div></br></div>'); | ||
50 | +}); | ||
51 | +</script> | ||
52 | +{% endblock content %} |
@@ -0,0 +1,38 @@ | @@ -0,0 +1,38 @@ | ||
1 | +from django.shortcuts import render, get_object_or_404, redirect | ||
2 | +from django.views import generic | ||
3 | +from django.contrib.auth.decorators import login_required | ||
4 | +from django.core.paginator import Paginator, EmptyPage | ||
5 | +from django.contrib.auth.mixins import LoginRequiredMixin | ||
6 | +from rolepermissions.mixins import HasRoleMixin | ||
7 | +from django.core.urlresolvers import reverse_lazy | ||
8 | +from django.utils.translation import ugettext_lazy as _ | ||
9 | +from rolepermissions.verifications import has_role | ||
10 | +from rolepermissions.verifications import has_object_permission | ||
11 | + | ||
12 | +# from .forms import CourseForm, UpdateCourseForm, CategoryForm, SubjectForm,TopicForm | ||
13 | +# from .models import Course, Subject, Category,Topic, SubjectCategory | ||
14 | +from core.mixins import NotificationMixin | ||
15 | +from users.models import User | ||
16 | +from courses.models import Course | ||
17 | + | ||
18 | +class Poll(generic.TemplateView): | ||
19 | + | ||
20 | + # login_url = reverse_lazy("core:home") | ||
21 | + # redirect_field_name = 'next' | ||
22 | + # model = Course | ||
23 | + # context_object_name = 'course' | ||
24 | + template_name = 'poll/poll.html' | ||
25 | + # queryset = Course.objects.all() | ||
26 | + | ||
27 | + # def get_queryset(self): | ||
28 | + # return Course.objects.all()[0] | ||
29 | + | ||
30 | + def get_context_data(self, **kwargs): | ||
31 | + context = super(Poll, self).get_context_data(**kwargs) | ||
32 | + course = Course.objects.all()[0] | ||
33 | + context['course'] = course | ||
34 | + context['subject'] = course.subjects.all()[0] | ||
35 | + context['subjects'] = course.subjects.all() | ||
36 | + # if (has_role(self.request.user,'system_admin')): | ||
37 | + # context['subjects'] = self.object.course.subjects.all() | ||
38 | + return context |
users/forms.py
@@ -40,6 +40,7 @@ class EditUserForm(forms.ModelForm): | @@ -40,6 +40,7 @@ class EditUserForm(forms.ModelForm): | ||
40 | 40 | ||
41 | # Ailson | 41 | # Ailson |
42 | class UpdateUserForm(forms.ModelForm): | 42 | class UpdateUserForm(forms.ModelForm): |
43 | + company_logo = forms.ImageField(label=_('Company Logo'),required=False, error_messages = {'invalid':_("Image files only")}) | ||
43 | 44 | ||
44 | class Meta: | 45 | class Meta: |
45 | model = User | 46 | model = User |
users/templates/users/update.html
@@ -46,18 +46,14 @@ | @@ -46,18 +46,14 @@ | ||
46 | </button> | 46 | </button> |
47 | </span> | 47 | </span> |
48 | </div> | 48 | </div> |
49 | - {% elif field.auto_id == 'id_is_staff' or field.auto_id == 'id_is_active' %} | ||
50 | - <div class="checkbox"> | ||
51 | - <label> | ||
52 | - {% render_field field type='checkbox' %} | ||
53 | - </label> | ||
54 | - </div> | 49 | + {% elif field.auto_id == 'id_cpf' %} |
50 | + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %} | ||
55 | {% else %} | 51 | {% else %} |
56 | {% render_field field class='form-control' %} | 52 | {% render_field field class='form-control' %} |
57 | <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | 53 | <span id="helpBlock" class="help-block">{{ field.help_text }}</span> |
58 | {% endif %} | 54 | {% endif %} |
59 | - {% if field.errors.length > 0 %} | ||
60 | - <div class="alert alert-danger alert-dismissible" role="alert"> | 55 | + {% if field.errors %} |
56 | + <div class="alert alert-danger alert-dismissible col-md-offset-4 col-md-8" role="alert"> | ||
61 | <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | 57 | <button type="button" class="close" data-dismiss="alert" aria-label="Close"> |
62 | <span aria-hidden="true">×</span> | 58 | <span aria-hidden="true">×</span> |
63 | </button> | 59 | </button> |
@@ -67,7 +63,6 @@ | @@ -67,7 +63,6 @@ | ||
67 | {% endfor %} | 63 | {% endfor %} |
68 | </ul> | 64 | </ul> |
69 | </div> | 65 | </div> |
70 | - </div> | ||
71 | {% endif %} | 66 | {% endif %} |
72 | </div> | 67 | </div> |
73 | {% endfor %} | 68 | {% endfor %} |