Commit 0b412aee121ced3218a87798bb14e6b7cdafa6fa
Exists in
master
and in
5 other branches
Fixing conflit
Showing
56 changed files
with
410 additions
and
1357 deletions
Show diff stats
amadeus/settings.py
... | ... | @@ -78,8 +78,8 @@ TEMPLATES = [ |
78 | 78 | 'django.contrib.auth.context_processors.auth', |
79 | 79 | 'django.contrib.messages.context_processors.messages', |
80 | 80 | |
81 | - 'core.context_processors.notifications', | |
82 | - 'courses.context_processors.courses', | |
81 | + # 'core.context_processors.notifications', | |
82 | + # 'courses.context_processors.courses', | |
83 | 83 | ], |
84 | 84 | }, |
85 | 85 | }, | ... | ... |
app/migrations/__init__.py
app/views.py
... | ... | @@ -18,8 +18,7 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): |
18 | 18 | context_object_name = 'objects' |
19 | 19 | paginate_by = 10 |
20 | 20 | |
21 | - not_action = "Acessar" | |
22 | - not_resource = "home" | |
21 | + | |
23 | 22 | |
24 | 23 | def get_queryset(self): |
25 | 24 | if self.request.user.is_staff: |
... | ... | @@ -43,7 +42,7 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): |
43 | 42 | else: |
44 | 43 | self.template_name = "home_teacher_student_content.html" |
45 | 44 | |
46 | - | |
45 | + #super(AppIndex, self).createNotification("testando notificacao de login", resource_name="home", resource_link="/") | |
47 | 46 | return self.response_class(request = self.request, template = self.template_name, context = context, using = self.template_engine, **response_kwargs) |
48 | 47 | |
49 | 48 | ... | ... |
core/context_processors.py
1 | 1 | from .models import Notification |
2 | 2 | |
3 | 3 | def notifications(request): |
4 | - if request.user.is_authenticated: | |
5 | - return { | |
6 | - 'notifications': Notification.objects.filter(user= request.user, read=False).order_by('-datetime') | |
7 | - } | |
8 | - else: | |
9 | - return request | |
10 | 4 | \ No newline at end of file |
5 | + context = {} | |
6 | + context['notifications'] = None | |
7 | + if not request.user is None: | |
8 | + if request.user.is_authenticated: | |
9 | + return { | |
10 | + 'notifications': Notification.objects.filter(user= request.user, read=False).order_by('-datetime') | |
11 | + } | |
12 | + return context | ... | ... |
core/decorators.py
... | ... | @@ -47,41 +47,41 @@ def log_decorator(log_action = '', log_resource = ''): |
47 | 47 | return _log_decorator |
48 | 48 | |
49 | 49 | |
50 | -def notification_decorator(read = False, message = '', actor = None, users = [], not_action='', not_resource=''): | |
50 | +def notification_decorator(read = False, message = '', actor = None, users = [], not_action='', not_resource='', resource_link=''): | |
51 | 51 | |
52 | 52 | def _notification_decorator(view_function): |
53 | 53 | |
54 | 54 | def _decorator(request, *args, **kwargs): |
55 | 55 | #Do something before the call |
56 | - | |
56 | + | |
57 | 57 | response = view_function(request, *args, **kwargs) |
58 | 58 | action = Action.objects.filter(name = not_action) |
59 | 59 | resource = Resource.objects.filter(name = not_resource) |
60 | - | |
61 | - if not action: | |
60 | + print(resource_link) | |
61 | + if action.exists(): | |
62 | + action = action[0] | |
63 | + else: | |
62 | 64 | action = Action(name = not_action) |
63 | 65 | action.save() |
64 | - else: | |
65 | - action = action[0] | |
66 | 66 | |
67 | - if not resource: | |
68 | - resource = Resource(name = not_resource) | |
69 | - resource.save() | |
70 | - else: | |
67 | + if resource.exists(): | |
71 | 68 | resource = resource[0] |
69 | + else: | |
70 | + resource = Resource(name = not_resource, url= resource_link) | |
71 | + print(resource) | |
72 | + resource.save() | |
72 | 73 | |
73 | 74 | action_resource = Action_Resource.objects.filter(action = action, resource = resource) |
74 | 75 | |
75 | - if not action_resource: | |
76 | + if action_resource.exists(): | |
77 | + action_resource = action_resource[0] | |
78 | + else: | |
76 | 79 | action_resource = Action_Resource(action = action, resource = resource) |
77 | 80 | action_resource.save() |
78 | - else: | |
79 | - action_resource = action_resource[0] | |
80 | - | |
81 | - if request.user.is_authenticated: #the user was authenticated by the view | |
82 | - notification = Notification(actor = request.user, message= message, | |
83 | - action_resource = action_resource, user = request.user) | |
84 | 81 | |
82 | + for user in users: | |
83 | + notification = Notification(user=user, actor= actor, message=message, action_resource= action_resource) | |
84 | + notification.save() | |
85 | 85 | |
86 | 86 | |
87 | 87 | #Do something after the call | ... | ... |
core/migrations/0001_initial.py
1 | 1 | # -*- coding: utf-8 -*- |
2 | -# Generated by Django 1.10 on 2016-09-06 17:50 | |
2 | +# Generated by Django 1.10 on 2016-09-20 13:57 | |
3 | 3 | from __future__ import unicode_literals |
4 | 4 | |
5 | +import autoslug.fields | |
5 | 6 | from django.conf import settings |
6 | 7 | from django.db import migrations, models |
7 | 8 | import django.db.models.deletion |
... | ... | @@ -24,8 +25,8 @@ class Migration(migrations.Migration): |
24 | 25 | ('created_date', models.DateField(auto_now_add=True, verbose_name='Created Date')), |
25 | 26 | ], |
26 | 27 | options={ |
27 | - 'verbose_name': 'Action', | |
28 | 28 | 'verbose_name_plural': 'Actions', |
29 | + 'verbose_name': 'Action', | |
29 | 30 | }, |
30 | 31 | ), |
31 | 32 | migrations.CreateModel( |
... | ... | @@ -35,22 +36,37 @@ class Migration(migrations.Migration): |
35 | 36 | ('action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied')), |
36 | 37 | ], |
37 | 38 | options={ |
38 | - 'verbose_name': 'Action_Resource', | |
39 | 39 | 'verbose_name_plural': 'Action_Resources', |
40 | + 'verbose_name': 'Action_Resource', | |
41 | + }, | |
42 | + ), | |
43 | + migrations.CreateModel( | |
44 | + name='Log', | |
45 | + fields=[ | |
46 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |
47 | + ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), | |
48 | + ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')), | |
49 | + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor')), | |
50 | + ], | |
51 | + options={ | |
52 | + 'verbose_name_plural': 'Logs', | |
53 | + 'verbose_name': 'Log', | |
40 | 54 | }, |
41 | 55 | ), |
42 | 56 | migrations.CreateModel( |
43 | 57 | name='Notification', |
44 | 58 | fields=[ |
45 | 59 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
46 | - ('message', models.TextField(verbose_name='message')), | |
60 | + ('message', models.TextField(verbose_name='Message')), | |
47 | 61 | ('read', models.BooleanField(default=False, verbose_name='Read')), |
62 | + ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), | |
48 | 63 | ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')), |
49 | - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor')), | |
64 | + ('actor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notification_Performer', to=settings.AUTH_USER_MODEL, verbose_name='Perfomer')), | |
65 | + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User')), | |
50 | 66 | ], |
51 | 67 | options={ |
52 | - 'verbose_name': 'Action_Resource', | |
53 | - 'verbose_name_plural': 'Action_Resources', | |
68 | + 'verbose_name_plural': 'Notifications', | |
69 | + 'verbose_name': 'Notification', | |
54 | 70 | }, |
55 | 71 | ), |
56 | 72 | migrations.CreateModel( |
... | ... | @@ -58,11 +74,13 @@ class Migration(migrations.Migration): |
58 | 74 | fields=[ |
59 | 75 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
60 | 76 | ('name', models.CharField(max_length=100, verbose_name='Name')), |
77 | + ('slug', autoslug.fields.AutoSlugField(editable=False, null=True, populate_from='name', unique=True, verbose_name='Slug')), | |
61 | 78 | ('created_date', models.DateField(auto_now_add=True, verbose_name='Created Date')), |
79 | + ('url', models.CharField(default='', max_length=100, verbose_name='URL')), | |
62 | 80 | ], |
63 | 81 | options={ |
64 | - 'verbose_name': 'Resource', | |
65 | 82 | 'verbose_name_plural': 'Resources', |
83 | + 'verbose_name': 'Resource', | |
66 | 84 | }, |
67 | 85 | ), |
68 | 86 | migrations.AddField( | ... | ... |
core/migrations/0002_auto_20160907_0038.py
... | ... | @@ -1,48 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.9.7 on 2016-09-07 03:38 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -import datetime | |
6 | -from django.conf import settings | |
7 | -from django.db import migrations, models | |
8 | -import django.db.models.deletion | |
9 | -from django.utils.timezone import utc | |
10 | - | |
11 | - | |
12 | -class Migration(migrations.Migration): | |
13 | - | |
14 | - dependencies = [ | |
15 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
16 | - ('core', '0001_initial'), | |
17 | - ] | |
18 | - | |
19 | - operations = [ | |
20 | - migrations.CreateModel( | |
21 | - name='Log', | |
22 | - fields=[ | |
23 | - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |
24 | - ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), | |
25 | - ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')), | |
26 | - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor')), | |
27 | - ], | |
28 | - options={ | |
29 | - 'verbose_name_plural': 'Logs', | |
30 | - 'verbose_name': 'Log', | |
31 | - }, | |
32 | - ), | |
33 | - migrations.AlterModelOptions( | |
34 | - name='notification', | |
35 | - options={'verbose_name': 'Notification', 'verbose_name_plural': 'Notifications'}, | |
36 | - ), | |
37 | - migrations.AddField( | |
38 | - model_name='notification', | |
39 | - name='datetime', | |
40 | - field=models.DateTimeField(auto_now_add=True, default=datetime.datetime(2016, 9, 7, 3, 38, 49, 367825, tzinfo=utc), verbose_name='Date and Time of action'), | |
41 | - preserve_default=False, | |
42 | - ), | |
43 | - migrations.AlterField( | |
44 | - model_name='notification', | |
45 | - name='message', | |
46 | - field=models.TextField(verbose_name='Message'), | |
47 | - ), | |
48 | - ] |
core/migrations/0003_auto_20160908_1108.py
... | ... | @@ -1,28 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-08 14:08 | |
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 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
14 | - ('core', '0002_auto_20160907_0038'), | |
15 | - ] | |
16 | - | |
17 | - operations = [ | |
18 | - migrations.AddField( | |
19 | - model_name='notification', | |
20 | - name='actor', | |
21 | - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notification_Performer', to=settings.AUTH_USER_MODEL, verbose_name='Perfomer'), | |
22 | - ), | |
23 | - migrations.AlterField( | |
24 | - model_name='notification', | |
25 | - name='user', | |
26 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User'), | |
27 | - ), | |
28 | - ] |
core/migrations/0004_auto_20160908_1151.py
... | ... | @@ -1,20 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-08 14:51 | |
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 | - ('core', '0003_auto_20160908_1108'), | |
12 | - ] | |
13 | - | |
14 | - operations = [ | |
15 | - migrations.AlterField( | |
16 | - model_name='resource', | |
17 | - name='name', | |
18 | - field=models.CharField(max_length=100, unique=True, verbose_name='Name'), | |
19 | - ), | |
20 | - ] |
core/migrations/0005_resource_link.py
... | ... | @@ -1,20 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-12 14:36 | |
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 | - ('core', '0004_auto_20160908_1151'), | |
12 | - ] | |
13 | - | |
14 | - operations = [ | |
15 | - migrations.AddField( | |
16 | - model_name='resource', | |
17 | - name='link', | |
18 | - field=models.CharField(default='', max_length=100, unique=True, verbose_name='URL'), | |
19 | - ), | |
20 | - ] |
core/migrations/0006_auto_20160912_1138.py
... | ... | @@ -1,20 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-12 14: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 | - ('core', '0005_resource_link'), | |
12 | - ] | |
13 | - | |
14 | - operations = [ | |
15 | - migrations.AlterField( | |
16 | - model_name='resource', | |
17 | - name='link', | |
18 | - field=models.CharField(default='', max_length=100, verbose_name='URL'), | |
19 | - ), | |
20 | - ] |
core/migrations/0007_remove_resource_link.py
... | ... | @@ -1,19 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-12 14:51 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -from django.db import migrations | |
6 | - | |
7 | - | |
8 | -class Migration(migrations.Migration): | |
9 | - | |
10 | - dependencies = [ | |
11 | - ('core', '0006_auto_20160912_1138'), | |
12 | - ] | |
13 | - | |
14 | - operations = [ | |
15 | - migrations.RemoveField( | |
16 | - model_name='resource', | |
17 | - name='link', | |
18 | - ), | |
19 | - ] |
core/migrations/0008_resource_link.py
... | ... | @@ -1,20 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-12 14:52 | |
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 | - ('core', '0007_remove_resource_link'), | |
12 | - ] | |
13 | - | |
14 | - operations = [ | |
15 | - migrations.AddField( | |
16 | - model_name='resource', | |
17 | - name='link', | |
18 | - field=models.CharField(default='', max_length=100, verbose_name='URL'), | |
19 | - ), | |
20 | - ] |
core/migrations/0009_auto_20160916_0126.py
... | ... | @@ -1,20 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-16 04:26 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -from django.db import migrations | |
6 | - | |
7 | - | |
8 | -class Migration(migrations.Migration): | |
9 | - | |
10 | - dependencies = [ | |
11 | - ('core', '0008_resource_link'), | |
12 | - ] | |
13 | - | |
14 | - operations = [ | |
15 | - migrations.RenameField( | |
16 | - model_name='resource', | |
17 | - old_name='link', | |
18 | - new_name='url', | |
19 | - ), | |
20 | - ] |
core/mixins.py
... | ... | @@ -41,24 +41,23 @@ class LogMixin(object): |
41 | 41 | class NotificationMixin(object): |
42 | 42 | message = "" |
43 | 43 | read = False |
44 | - not_action = '' | |
45 | - not_resource = '' | |
44 | + action_name = '' | |
45 | + resource_name = '' | |
46 | 46 | |
47 | - def createNotification(self, message='', actor=None, users = User.objects.all(), not_action = '', not_resource='', resource_link=''): #the default will be a broadcast | |
48 | - action = Action.objects.filter(name = self.not_action) | |
49 | - resource = Resource.objects.filter(name = not_resource) | |
50 | - print(resource_link) | |
47 | + def createNotification(self, message='', actor=None, users = User.objects.all(), resource_slug='' ,action_name = '', resource_name='', resource_link=''): #the default will be a broadcast | |
48 | + action = Action.objects.filter(name = action_name) | |
49 | + resource = Resource.objects.filter(slug = resource_slug) | |
50 | + print(message) | |
51 | 51 | if action.exists(): |
52 | 52 | action = action[0] |
53 | 53 | else: |
54 | - action = Action(name = self.not_action) | |
54 | + action = Action(name = self.action_name) | |
55 | 55 | action.save() |
56 | 56 | |
57 | 57 | if resource.exists(): |
58 | 58 | resource = resource[0] |
59 | 59 | else: |
60 | - resource = Resource(name = self.not_resource, link= resource_link) | |
61 | - print(resource) | |
60 | + resource = Resource(name = self.resource_name, url= resource_link) | |
62 | 61 | resource.save() |
63 | 62 | |
64 | 63 | action_resource = Action_Resource.objects.filter(action = action, resource = resource) |
... | ... | @@ -77,4 +76,5 @@ class NotificationMixin(object): |
77 | 76 | def dispatch(self, request, *args, **kwargs): |
78 | 77 | """ |
79 | 78 | Not quite sure how to do about it""" |
79 | + print("testing IF IT REACHES HERE") | |
80 | 80 | return super(NotificationMixin, self).dispatch(request, *args, **kwargs) |
81 | 81 | \ No newline at end of file | ... | ... |
core/models.py
1 | 1 | from django.db import models |
2 | 2 | from django.utils.translation import ugettext_lazy as _ |
3 | 3 | from users.models import User |
4 | +from autoslug.fields import AutoSlugField | |
4 | 5 | # Create your models here. |
5 | 6 | |
6 | 7 | class Action(models.Model): |
... | ... | @@ -32,7 +33,8 @@ class Resource(models.Model): |
32 | 33 | @link: Which URL made that resource able to find |
33 | 34 | """ |
34 | 35 | |
35 | - name = models.CharField(_('Name'), max_length =100, unique=True) | |
36 | + name = models.CharField(_('Name'), max_length =100) | |
37 | + slug = AutoSlugField(_("Slug"), populate_from='name', unique=True, null=True) | |
36 | 38 | created_date = models.DateField(_('Created Date'), auto_now_add=True) |
37 | 39 | url = models.CharField(_('URL'), max_length =100, default="") |
38 | 40 | ... | ... |
core/static/css/base/amadeus.css
core/templates/base.html
... | ... | @@ -54,7 +54,7 @@ |
54 | 54 | <ul class="nav navbar-nav navbar-right notifications"> |
55 | 55 | <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications"> |
56 | 56 | <a class="dropdown-toggle" data-toggle="dropdown"> <span class="badge notification-count">{{notifications.count}}</span><i class="fa fa-bell-o" aria-hidden="true"></i></a> |
57 | - <ul class="dropdown-menu"> | |
57 | + <ul id="notification-dropdown" class="dropdown-menu"> | |
58 | 58 | <li class="dropdown-header">Notifications</li> |
59 | 59 | {% for notification in notifications %} |
60 | 60 | {% if notification.actor %} <!-- if the notification has a user--> | ... | ... |
core/templates/index.html
... | ... | @@ -10,71 +10,86 @@ |
10 | 10 | {% endblock sidebar %} |
11 | 11 | |
12 | 12 | {% block content %} |
13 | - <div class="row logo-row"> | |
14 | - <div class="col-lg-offset-2 col-lg-9"> | |
15 | - <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus" id="logo"> | |
13 | + <div class="row"> | |
14 | + <div class="col-md-4 col-md-offset-4"> | |
15 | + <div class="row"> | |
16 | + <div class="col-md-offset-2 col-md-8"> | |
17 | + </br> | |
18 | + </br> | |
19 | + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus"> | |
20 | + </br> | |
21 | + </div> | |
22 | + </div> | |
16 | 23 | </div> |
17 | - | |
18 | 24 | <div class="row"> |
19 | 25 | {% for breadcrumb in breadcrumbs %} |
20 | 26 | <a href="{{ breadcrumb.url }}">{{ breadcrumb.text }}</a> |
21 | 27 | {% endfor %} |
22 | - </div> | |
23 | - | |
24 | - <div class="row "> | |
25 | - <div class="col-md-8 col-md-offset-2 col-sm-6 col-sm-offset-3"> | |
26 | - <div class="card"> | |
27 | - {% if message %} | |
28 | - <div class="alert alert-danger fade in"> | |
29 | - {{message}} | |
30 | - </div> | |
31 | - | |
32 | - {% endif %} | |
33 | - <div class="card-content"> | |
34 | - | |
35 | - <form id="form-login" class="form-group" method="post" action=""> | |
36 | - {% csrf_token %} | |
37 | - <div class="form-group is-empty"> | |
38 | - <label for="inputEmail" class="col-md-4 control-label"> {% trans 'Username' %}</label> | |
39 | - <div class="col-md-8"> | |
40 | - <input form="form-login" type="text" name="username" class="form-control" id="inputEmail" placeholder="Username"> | |
41 | - </div> | |
42 | - </div> | |
43 | - <div class="form-group is-empty"> | |
44 | - <label for="inputPassword" class="col-md-4 control-label"> {% trans 'Password' %}</label> | |
45 | - <div class="col-md-8"> | |
46 | - <input form="form-login" type="password" name="password" class="form-control" id="inputPassword" placeholder="Password"> | |
47 | - </div> | |
48 | - </div> | |
49 | - <div class=" col-md-10"> | |
50 | - <div class="checkbox"> | |
51 | - <label> | |
52 | - <input form="form-login" type="checkbox" name="checkbox"><span class="checkbox-material"><span class="check"></span></span> {% trans 'Remember Email' %} | |
53 | - </label> | |
54 | - </div> | |
55 | - </div> | |
56 | - </form> | |
57 | - | |
28 | + </div> | |
58 | 29 | |
59 | - | |
60 | - <div class="col-md-6 col-xs-6"> | |
61 | - <button type="button" class="btn btn-flat" formaction="#" style="position: initial;">{% trans 'Guest' %}</button> | |
30 | + <div class="row "> | |
31 | + <div class="col-md-8 col-md-offset-2 col-sm-6 col-sm-offset-3"> | |
32 | + {% if message %} | |
33 | + <div class="alert alert-danger alert-dismissible" role="alert"> | |
34 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
35 | + <span aria-hidden="true">×</span> | |
36 | + </button> | |
37 | + <ul> | |
38 | + <li>{{ message }}</li> | |
39 | + </ul> | |
40 | + </div> | |
41 | + {% endif %} | |
42 | + <div class="card"> | |
43 | + <div class="card-block"> | |
44 | + {# <div class="row"> #} | |
45 | + <form id="form-login" class="form-group" method="post" action=""> | |
46 | + {% csrf_token %} | |
47 | + <div class="form-group is-empty"> | |
48 | + <label for="inputEmail" class="col-md-4 control-label"> {% trans 'Username' %}</label> | |
49 | + <div class="col-md-8"> | |
50 | + <input form="form-login" type="text" name="username" class="form-control" id="inputEmail" placeholder="Username" value="{% if username %}{{username}}{% endif %}"> | |
62 | 51 | </div> |
63 | - <div class="col-md-6 col-xs-6"> | |
64 | - <button type="submite" class="btn btn-flat btn-success" form="form-login" style="position: initial;">{% trans 'Login' %}</button> | |
52 | + </div> | |
53 | + <div class="form-group is-empty"> | |
54 | + <label for="inputPassword" class="col-md-4 control-label"> {% trans 'Password' %}</label> | |
55 | + <div class="col-md-8"> | |
56 | + <input form="form-login" type="password" name="password" class="form-control" id="inputPassword" placeholder="Password"> | |
57 | + </div> | |
58 | + </div> | |
59 | + <div class="col-md-10"> | |
60 | + <div class="checkbox"> | |
61 | + <label> | |
62 | + <input form="form-login" type="checkbox" name="checkbox"><span class="checkbox-material"><span class="check"></span></span> {% trans 'Remember Email' %} | |
63 | + </label> | |
65 | 64 | </div> |
66 | - | |
65 | + </div> | |
66 | + </form> | |
67 | + {# </div> #} | |
68 | + {# <div class="row"> #} | |
69 | + <div class="col-md-10"> | |
70 | + <a href="{% url 'core:remember_password' %}">Forgot your password?</a> | |
71 | + </div> | |
72 | + {# </div> #} | |
73 | + {# <div class="row"> #} | |
74 | + <div class="col-md-6 col-xs-6 text-center"> | |
75 | + <button type="button" class="btn btn-flat" formaction="#" style="position: initial;">{% trans 'Guest' %}</button> | |
76 | + </div> | |
77 | + <div class="col-md-6 col-xs-6 text-center"> | |
78 | + <button type="submite" class="btn btn-flat btn-success" form="form-login" style="position: initial;">{% trans 'Login' %}</button> | |
79 | + </div> | |
80 | + {# </div> #} | |
67 | 81 | </div> |
68 | - </div> | |
69 | - </div> | |
82 | + </div> | |
83 | + </div> | |
70 | 84 | </div> |
71 | 85 | <div class="row"> |
72 | - <div class="col-lg-offset-2 col-lg-8 col-md-8 col-md-offset-2 col-sm-6 col-sm-offset-3"> | |
73 | - <a class="btn btn-raised btn-primary btn-lg btn-block" href="{% url 'core:register' %}">{% trans 'Sign Up' %} </a> | |
74 | - </div> | |
86 | + <div class="col-lg-offset-2 col-lg-8 col-md-8 col-md-offset-2 col-sm-6 col-sm-offset-3"> | |
87 | + <a class="btn btn-raised btn-primary btn-lg btn-block" href="{% url 'core:register' %}">{% trans 'Sign Up' %} </a> | |
88 | + </div> | |
75 | 89 | </div> |
90 | + </div> | |
76 | 91 | {% endblock%} |
77 | 92 | |
78 | 93 | {% block rightbar %} |
79 | - | |
80 | -{% endblock rightbar %} | |
81 | 94 | \ No newline at end of file |
95 | + | |
96 | +{% endblock rightbar %} | ... | ... |
core/templates/remember_password.html
1 | 1 | {% extends "index.html" %} |
2 | -{% load i18n %} | |
3 | -{% block content %} | |
2 | +{% load i18n static %} | |
3 | +{% block content%} | |
4 | 4 | |
5 | - <div class="row logo-row"> | |
6 | - <div class="col-lg-offset-2 col-lg-9"> | |
7 | - <img src="..." class="img-responsive center-block " alt="logo amadeus"> | |
8 | - </div> | |
9 | - </div> | |
10 | - <div class="row "> | |
11 | - <div class="col-lg-9 col-lg-offset-2"> | |
12 | - <div class="card"> | |
13 | - {% if success %} | |
14 | - <div class="alert alert-success fade in"> | |
15 | - {{success}} | |
16 | - </div> | |
17 | - {% elif danger %} | |
18 | - <div class="alert alert-danger fade in"> | |
19 | - {{danger}} | |
20 | - </div> | |
21 | - {% endif %} | |
22 | - <div class="card-content"> | |
23 | - <div class="card-body"> | |
5 | + <div class="row"> | |
6 | + <div class="col-md-4 col-md-offset-4"> | |
7 | + <div class="row"> | |
8 | + <div class="col-md-offset-2 col-md-8"> | |
9 | + </br> | |
10 | + </br> | |
11 | + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus"> | |
12 | + </br> | |
13 | + </div> | |
14 | + </div> | |
15 | + </div> | |
16 | + <div class="row "> | |
17 | + <div class="col-lg-9 col-lg-offset-2"> | |
18 | + {% if success %} | |
19 | + <div class="alert alert-success alert-dismissible" role="alert"> | |
20 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
21 | + <span aria-hidden="true">×</span> | |
22 | + </button> | |
23 | + <ul> | |
24 | + <li>{{ success }}</li> | |
25 | + </ul> | |
26 | + </div> | |
27 | + {% elif danger %} | |
28 | + <div class="alert alert-danger alert-dismissible" role="alert"> | |
29 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
30 | + <span aria-hidden="true">×</span> | |
31 | + </button> | |
32 | + <ul> | |
33 | + <li>{{ danger }}</li> | |
34 | + </ul> | |
35 | + </div> | |
36 | + {% endif %} | |
37 | + <div class="card"> | |
38 | + <div class="card-block"> | |
39 | + <div class="col-md-12"> | |
24 | 40 | <form class="form-group " method="post" action=""> |
25 | 41 | {% csrf_token %} |
26 | - <div class="form-group"> | |
27 | - <label for="inputEmail" class="control-label label-static"> {% trans 'E-mail' %}</label> | |
28 | - <input name="email" type="email" class="form-control" id="inputEmail" placeholder="Email" {% if email %}value="{{email}}"{% endif %}> | |
42 | + <div class="form-group is-empty"> | |
43 | + <label for="inputEmail" class="ccontrol-label"> {% trans 'E-mail' %}</label> | |
44 | + {# <div class="col-md-8"> #} | |
45 | + <input name="email" type="email" class="form-control" id="inputEmail" placeholder="Email" {% if email %}value="{{email}}"{% endif %}> | |
46 | + {# </div> #} | |
29 | 47 | </div> |
30 | - <div class="form-group"> | |
31 | - <label for="inputRegistration" class=" control-label"> {% trans 'Registration' %} </label> | |
32 | - <input name="registration" type="text" class="form-control" id="inputRegistration" placeholder="Registration" {% if registration %}value="{{registration}}"{% endif %}> | |
48 | + <div class="form-group is-empty"> | |
49 | + <label for="inputRegistration" class="control-label"> {% trans 'Registration' %} </label> | |
50 | + {# <div class="col-md-8"> #} | |
51 | + <input name="registration" type="text" class="col-md-4 form-control" id="inputRegistration" placeholder="Registration" {% if registration %}value="{{registration}}"{% endif %}> | |
52 | + {# </div> #} | |
33 | 53 | </div> |
34 | - <div class="col-lg-offset-4 col-lg-4"> | |
35 | - <button type="submite" class="btn btn-raised btn-primary btn-lg btn-block">{% trans 'Send' %}</button> | |
36 | - | |
37 | - </div> | |
54 | + <div class="col-lg-offset-4 col-lg-4"> | |
55 | + <button type="submite" class="btn btn-raised btn-primary btn-lg btn-block">{% trans 'Send' %}</button> | |
38 | 56 | |
57 | + </div> | |
39 | 58 | </form> |
40 | 59 | </div> |
41 | - | |
42 | - </div> | |
43 | - | |
44 | - | |
60 | + </div> | |
61 | + </div> | |
62 | + </div> | |
45 | 63 | </div> |
46 | 64 | </div> |
47 | - </div> | |
48 | 65 | |
49 | 66 | {% endblock content %} | ... | ... |
core/views.py
... | ... | @@ -71,7 +71,7 @@ def remember_password(request): |
71 | 71 | @log_decorator('Acessar', 'Sistema') |
72 | 72 | def login(request): |
73 | 73 | context = {} |
74 | - | |
74 | + | |
75 | 75 | if request.POST: |
76 | 76 | username = request.POST['username'] |
77 | 77 | password = request.POST['password'] |
... | ... | @@ -81,9 +81,10 @@ def login(request): |
81 | 81 | return redirect(reverse("app:index")) |
82 | 82 | else: |
83 | 83 | context["message"] = _("E-mail or password are incorrect!") |
84 | + context["username"] = username | |
84 | 85 | elif request.user.is_authenticated: |
85 | 86 | return redirect(reverse('app:index')) |
86 | - | |
87 | + | |
87 | 88 | return render(request,"index.html",context) |
88 | 89 | |
89 | 90 | |
... | ... | @@ -92,8 +93,7 @@ def processNotification(self, notificationId): |
92 | 93 | notification = Notification.objects.get(id= notificationId) |
93 | 94 | notification.read = True |
94 | 95 | notification.save() |
95 | - | |
96 | - return redirect(notification.action_resource.resource.link) | |
96 | + return redirect(notification.action_resource.resource.url) | |
97 | 97 | |
98 | 98 | # class LoginClass(LoginView): |
99 | 99 | # template_name='index.html' | ... | ... |
courses/context_processors.py
1 | 1 | from .models import Course |
2 | 2 | |
3 | 3 | def courses(request): |
4 | - if request.user.is_authenticated: | |
5 | - context = {} | |
6 | - | |
7 | - if request.user.is_staff: | |
8 | - context['courses_list'] = Course.objects.all() | |
9 | - else: | |
10 | - context['courses_list'] = Course.objects.filter(professors__in = [request.user]) | |
11 | - | |
12 | - return context | |
13 | - else: | |
14 | - return request | |
15 | 4 | \ No newline at end of file |
5 | + context = {} | |
6 | + context['courses_list'] = None | |
7 | + if not request.user is None: | |
8 | + if request.user.is_authenticated: | |
9 | + if request.user.is_staff: | |
10 | + context['courses_list'] = Course.objects.all() | |
11 | + else: | |
12 | + context['courses_list'] = Course.objects.filter(professors__in = [request.user]) | |
13 | + return context | |
14 | + return context | ... | ... |
courses/migrations/0001_initial.py
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.9.7 on 2016-07-18 22:41 | |
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 | - ] | |
15 | - | |
16 | - operations = [ | |
17 | - migrations.CreateModel( | |
18 | - name='Course', | |
19 | - fields=[ | |
20 | - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |
21 | - ('name', models.CharField(max_length=100, verbose_name='Nome')), | |
22 | - ('slug', models.SlugField(max_length=100, verbose_name='Identificador')), | |
23 | - ('objectivies', models.TextField(blank=True, verbose_name='Objetivos')), | |
24 | - ('content', models.TextField(blank=True, verbose_name='Conteúdo')), | |
25 | - ('max_students', models.PositiveIntegerField(blank=True, verbose_name='Máximo de Alunos')), | |
26 | - ('create_date', models.DateField(auto_now_add=True, verbose_name='Criação')), | |
27 | - ('init_register_date', models.DateField(verbose_name='Data de Cadastro (Início)')), | |
28 | - ('end_register_date', models.DateField(verbose_name='Data de Cadastro (Final)')), | |
29 | - ('init_date', models.DateField(verbose_name='Data de Início do Curso')), | |
30 | - ('end_date', models.DateField(verbose_name='Data de Final do Curso')), | |
31 | - ('image', models.ImageField(blank=True, upload_to='', verbose_name='Imagem')), | |
32 | - ], | |
33 | - options={ | |
34 | - 'verbose_name_plural': 'Cursos', | |
35 | - 'verbose_name': 'Curso', | |
36 | - }, | |
37 | - ), | |
38 | - migrations.CreateModel( | |
39 | - name='Module', | |
40 | - fields=[ | |
41 | - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |
42 | - ('name', models.CharField(max_length=100, verbose_name='Nome')), | |
43 | - ('slug', models.SlugField(max_length=100, verbose_name='Identificador')), | |
44 | - ('description', models.TextField(blank=True, verbose_name='Descrição')), | |
45 | - ('visible', models.BooleanField(default=True, verbose_name='Visível')), | |
46 | - ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Course', verbose_name='Curso')), | |
47 | - ], | |
48 | - options={ | |
49 | - 'verbose_name_plural': 'Módulos', | |
50 | - 'verbose_name': 'Módulo', | |
51 | - }, | |
52 | - ), | |
53 | - ] | |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2016-09-20 13:57 | |
3 | +from __future__ import unicode_literals | |
4 | + | |
5 | +import autoslug.fields | |
6 | +from django.conf import settings | |
7 | +from django.db import migrations, models | |
8 | +import django.db.models.deletion | |
9 | + | |
10 | + | |
11 | +class Migration(migrations.Migration): | |
12 | + | |
13 | + initial = True | |
14 | + | |
15 | + dependencies = [ | |
16 | + ('core', '0001_initial'), | |
17 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
18 | + ] | |
19 | + | |
20 | + operations = [ | |
21 | + migrations.CreateModel( | |
22 | + name='Activity', | |
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')), | |
25 | + ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), | |
26 | + ('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')), | |
28 | + ], | |
29 | + bases=('core.resource',), | |
30 | + ), | |
31 | + migrations.CreateModel( | |
32 | + name='Category', | |
33 | + fields=[ | |
34 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |
35 | + ('name', models.CharField(max_length=100, unique=True, verbose_name='Name')), | |
36 | + ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), | |
37 | + ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), | |
38 | + ], | |
39 | + options={ | |
40 | + 'verbose_name': 'Category', | |
41 | + 'verbose_name_plural': 'Categories', | |
42 | + }, | |
43 | + ), | |
44 | + migrations.CreateModel( | |
45 | + name='Course', | |
46 | + fields=[ | |
47 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |
48 | + ('name', models.CharField(max_length=100, verbose_name='Name')), | |
49 | + ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), | |
50 | + ('objectivies', models.TextField(blank=True, verbose_name='Objectivies')), | |
51 | + ('content', models.TextField(blank=True, verbose_name='Content')), | |
52 | + ('max_students', models.PositiveIntegerField(blank=True, verbose_name='Maximum Students')), | |
53 | + ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), | |
54 | + ('init_register_date', models.DateField(verbose_name='Register Date (Begin)')), | |
55 | + ('end_register_date', models.DateField(verbose_name='Register Date (End)')), | |
56 | + ('init_date', models.DateField(verbose_name='Begin of Course Date')), | |
57 | + ('end_date', models.DateField(verbose_name='End of Course Date')), | |
58 | + ('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')), | |
60 | + ('professors', models.ManyToManyField(related_name='courses', to=settings.AUTH_USER_MODEL, verbose_name='Professors')), | |
61 | + ('students', models.ManyToManyField(related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students')), | |
62 | + ], | |
63 | + options={ | |
64 | + 'verbose_name': 'Course', | |
65 | + 'verbose_name_plural': 'Courses', | |
66 | + 'ordering': ('create_date', 'name'), | |
67 | + }, | |
68 | + ), | |
69 | + migrations.CreateModel( | |
70 | + name='Material', | |
71 | + 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')), | |
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')), | |
75 | + ], | |
76 | + bases=('core.resource',), | |
77 | + ), | |
78 | + migrations.CreateModel( | |
79 | + name='Subject', | |
80 | + fields=[ | |
81 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |
82 | + ('name', models.CharField(max_length=100, verbose_name='Name')), | |
83 | + ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), | |
84 | + ('description', models.TextField(blank=True, verbose_name='Description')), | |
85 | + ('visible', models.BooleanField(default=False, verbose_name='Visible')), | |
86 | + ('init_date', models.DateField(verbose_name='Begin of Subject Date')), | |
87 | + ('end_date', models.DateField(verbose_name='End of Subject Date')), | |
88 | + ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), | |
89 | + ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), | |
90 | + ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course')), | |
91 | + ('professors', models.ManyToManyField(related_name='subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors')), | |
92 | + ], | |
93 | + options={ | |
94 | + 'verbose_name': 'Subject', | |
95 | + 'verbose_name_plural': 'Subjects', | |
96 | + 'ordering': ('create_date', 'name'), | |
97 | + }, | |
98 | + ), | |
99 | + migrations.CreateModel( | |
100 | + name='Topic', | |
101 | + fields=[ | |
102 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |
103 | + ('name', models.CharField(max_length=100, verbose_name='Name')), | |
104 | + ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), | |
105 | + ('description', models.TextField(blank=True, verbose_name='Description')), | |
106 | + ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), | |
107 | + ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), | |
108 | + ('visible', models.BooleanField(default=False, verbose_name='Visible')), | |
109 | + ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Owner')), | |
110 | + ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject')), | |
111 | + ], | |
112 | + options={ | |
113 | + 'verbose_name': 'Topic', | |
114 | + 'verbose_name_plural': 'Topics', | |
115 | + 'ordering': ('create_date', 'name'), | |
116 | + }, | |
117 | + ), | |
118 | + migrations.AddField( | |
119 | + model_name='material', | |
120 | + name='topic', | |
121 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Topic', verbose_name='Topic'), | |
122 | + ), | |
123 | + migrations.AddField( | |
124 | + model_name='activity', | |
125 | + name='topic', | |
126 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Topic', verbose_name='Topic'), | |
127 | + ), | |
128 | + ] | ... | ... |
courses/migrations/0002_auto_20160720_1837.py
... | ... | @@ -1,47 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.9.7 on 2016-07-20 21:37 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -import datetime | |
6 | -from django.db import migrations, models | |
7 | -import django.db.models.deletion | |
8 | -from django.utils.timezone import utc | |
9 | - | |
10 | - | |
11 | -class Migration(migrations.Migration): | |
12 | - | |
13 | - dependencies = [ | |
14 | - ('courses', '0001_initial'), | |
15 | - ] | |
16 | - | |
17 | - operations = [ | |
18 | - migrations.CreateModel( | |
19 | - name='Category', | |
20 | - fields=[ | |
21 | - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |
22 | - ('name', models.CharField(max_length=100, verbose_name='Nome')), | |
23 | - ('slug', models.SlugField(max_length=100, verbose_name='Identificador')), | |
24 | - ('create_date', models.DateField(auto_now_add=True, verbose_name='Criação')), | |
25 | - ], | |
26 | - options={ | |
27 | - 'verbose_name': 'Categoria', | |
28 | - 'verbose_name_plural': 'Categorias', | |
29 | - }, | |
30 | - ), | |
31 | - migrations.AddField( | |
32 | - model_name='module', | |
33 | - name='create_date', | |
34 | - field=models.DateField(auto_now_add=True, default=datetime.datetime(2016, 7, 20, 21, 37, 26, 975666, tzinfo=utc), verbose_name='Criação'), | |
35 | - preserve_default=False, | |
36 | - ), | |
37 | - migrations.AlterField( | |
38 | - model_name='course', | |
39 | - name='image', | |
40 | - field=models.ImageField(blank=True, default='uploads/no_image.jpg', upload_to='uploads/', verbose_name='Imagem'), | |
41 | - ), | |
42 | - migrations.AddField( | |
43 | - model_name='course', | |
44 | - name='category', | |
45 | - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='courses.Category', verbose_name='Categoria'), | |
46 | - ), | |
47 | - ] |
courses/migrations/0003_auto_20160722_1735.py
... | ... | @@ -1,25 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.9.7 on 2016-07-22 20:35 | |
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 | - ('courses', '0002_auto_20160720_1837'), | |
12 | - ] | |
13 | - | |
14 | - operations = [ | |
15 | - migrations.AlterField( | |
16 | - model_name='category', | |
17 | - name='name', | |
18 | - field=models.CharField(max_length=100, unique=True, verbose_name='Nome'), | |
19 | - ), | |
20 | - migrations.AlterField( | |
21 | - model_name='course', | |
22 | - name='name', | |
23 | - field=models.CharField(max_length=100, unique=True, verbose_name='Nome'), | |
24 | - ), | |
25 | - ] |
courses/migrations/0004_auto_20160728_1625.py
... | ... | @@ -1,20 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.9.7 on 2016-07-28 19:25 | |
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 | - ('courses', '0003_auto_20160722_1735'), | |
12 | - ] | |
13 | - | |
14 | - operations = [ | |
15 | - migrations.AlterField( | |
16 | - model_name='course', | |
17 | - name='image', | |
18 | - field=models.ImageField(blank=True, default='no_image.jpg', upload_to='courses/', verbose_name='Imagem'), | |
19 | - ), | |
20 | - ] |
courses/migrations/0005_auto_20160815_0922.py
... | ... | @@ -1,140 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.9.7 on 2016-08-15 12:22 | |
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 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
14 | - ('courses', '0004_auto_20160728_1625'), | |
15 | - ] | |
16 | - | |
17 | - operations = [ | |
18 | - migrations.AlterModelOptions( | |
19 | - name='category', | |
20 | - options={'verbose_name': 'Category', 'verbose_name_plural': 'Categories'}, | |
21 | - ), | |
22 | - migrations.AlterModelOptions( | |
23 | - name='course', | |
24 | - options={'verbose_name': 'Course', 'verbose_name_plural': 'Courses'}, | |
25 | - ), | |
26 | - migrations.AlterModelOptions( | |
27 | - name='module', | |
28 | - options={'verbose_name': 'Module', 'verbose_name_plural': 'Modules'}, | |
29 | - ), | |
30 | - migrations.AddField( | |
31 | - model_name='course', | |
32 | - name='user', | |
33 | - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='User'), | |
34 | - ), | |
35 | - migrations.AlterField( | |
36 | - model_name='category', | |
37 | - name='create_date', | |
38 | - field=models.DateField(auto_now_add=True, verbose_name='Creation Date'), | |
39 | - ), | |
40 | - migrations.AlterField( | |
41 | - model_name='category', | |
42 | - name='name', | |
43 | - field=models.CharField(max_length=100, unique=True, verbose_name='Name'), | |
44 | - ), | |
45 | - migrations.AlterField( | |
46 | - model_name='category', | |
47 | - name='slug', | |
48 | - field=models.SlugField(max_length=100, verbose_name='Slug'), | |
49 | - ), | |
50 | - migrations.AlterField( | |
51 | - model_name='course', | |
52 | - name='category', | |
53 | - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='courses.Category', verbose_name='Category'), | |
54 | - ), | |
55 | - migrations.AlterField( | |
56 | - model_name='course', | |
57 | - name='content', | |
58 | - field=models.TextField(blank=True, verbose_name='Content'), | |
59 | - ), | |
60 | - migrations.AlterField( | |
61 | - model_name='course', | |
62 | - name='create_date', | |
63 | - field=models.DateField(auto_now_add=True, verbose_name='Creation Date'), | |
64 | - ), | |
65 | - migrations.AlterField( | |
66 | - model_name='course', | |
67 | - name='end_date', | |
68 | - field=models.DateField(verbose_name='End of Course Date'), | |
69 | - ), | |
70 | - migrations.AlterField( | |
71 | - model_name='course', | |
72 | - name='end_register_date', | |
73 | - field=models.DateField(verbose_name='Register Date (End)'), | |
74 | - ), | |
75 | - migrations.AlterField( | |
76 | - model_name='course', | |
77 | - name='image', | |
78 | - field=models.ImageField(blank=True, default='no_image.jpg', upload_to='courses/', verbose_name='Image'), | |
79 | - ), | |
80 | - migrations.AlterField( | |
81 | - model_name='course', | |
82 | - name='init_date', | |
83 | - field=models.DateField(verbose_name='Begin of Course Date'), | |
84 | - ), | |
85 | - migrations.AlterField( | |
86 | - model_name='course', | |
87 | - name='init_register_date', | |
88 | - field=models.DateField(verbose_name='Register Date (Begin)'), | |
89 | - ), | |
90 | - migrations.AlterField( | |
91 | - model_name='course', | |
92 | - name='max_students', | |
93 | - field=models.PositiveIntegerField(blank=True, verbose_name='Maximum Students'), | |
94 | - ), | |
95 | - migrations.AlterField( | |
96 | - model_name='course', | |
97 | - name='name', | |
98 | - field=models.CharField(max_length=100, unique=True, verbose_name='Name'), | |
99 | - ), | |
100 | - migrations.AlterField( | |
101 | - model_name='course', | |
102 | - name='objectivies', | |
103 | - field=models.TextField(blank=True, verbose_name='Objectivies'), | |
104 | - ), | |
105 | - migrations.AlterField( | |
106 | - model_name='course', | |
107 | - name='slug', | |
108 | - field=models.SlugField(max_length=100, verbose_name='Slug'), | |
109 | - ), | |
110 | - migrations.AlterField( | |
111 | - model_name='module', | |
112 | - name='course', | |
113 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Course', verbose_name='Course'), | |
114 | - ), | |
115 | - migrations.AlterField( | |
116 | - model_name='module', | |
117 | - name='create_date', | |
118 | - field=models.DateField(auto_now_add=True, verbose_name='Creation Date'), | |
119 | - ), | |
120 | - migrations.AlterField( | |
121 | - model_name='module', | |
122 | - name='description', | |
123 | - field=models.TextField(blank=True, verbose_name='Description'), | |
124 | - ), | |
125 | - migrations.AlterField( | |
126 | - model_name='module', | |
127 | - name='name', | |
128 | - field=models.CharField(max_length=100, verbose_name='Name'), | |
129 | - ), | |
130 | - migrations.AlterField( | |
131 | - model_name='module', | |
132 | - name='slug', | |
133 | - field=models.SlugField(max_length=100, verbose_name='Slug'), | |
134 | - ), | |
135 | - migrations.AlterField( | |
136 | - model_name='module', | |
137 | - name='visible', | |
138 | - field=models.BooleanField(default=True, verbose_name='Visible'), | |
139 | - ), | |
140 | - ] |
courses/migrations/0006_auto_20160907_2259.py
... | ... | @@ -1,41 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-08 01:59 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -import autoslug.fields | |
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', '0005_auto_20160815_0922'), | |
14 | - ] | |
15 | - | |
16 | - operations = [ | |
17 | - migrations.CreateModel( | |
18 | - name='Subject', | |
19 | - fields=[ | |
20 | - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |
21 | - ('name', models.CharField(max_length=100, verbose_name='Name')), | |
22 | - ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), | |
23 | - ('description', models.TextField(blank=True, verbose_name='Description')), | |
24 | - ('visible', models.BooleanField(default=True, verbose_name='Visible')), | |
25 | - ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), | |
26 | - ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), | |
27 | - ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course')), | |
28 | - ], | |
29 | - options={ | |
30 | - 'verbose_name': 'Subject', | |
31 | - 'verbose_name_plural': 'Subjects', | |
32 | - }, | |
33 | - ), | |
34 | - migrations.RemoveField( | |
35 | - model_name='module', | |
36 | - name='course', | |
37 | - ), | |
38 | - migrations.DeleteModel( | |
39 | - name='Module', | |
40 | - ), | |
41 | - ] |
courses/migrations/0007_topic.py
... | ... | @@ -1,33 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-08 02:51 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -import autoslug.fields | |
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', '0006_auto_20160907_2259'), | |
14 | - ] | |
15 | - | |
16 | - operations = [ | |
17 | - migrations.CreateModel( | |
18 | - name='Topic', | |
19 | - fields=[ | |
20 | - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |
21 | - ('name', models.CharField(max_length=100, verbose_name='Name')), | |
22 | - ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), | |
23 | - ('description', models.TextField(blank=True, verbose_name='Description')), | |
24 | - ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), | |
25 | - ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), | |
26 | - ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topics', to='courses.Subject', verbose_name='Subject')), | |
27 | - ], | |
28 | - options={ | |
29 | - 'verbose_name': 'Topic', | |
30 | - 'verbose_name_plural': 'Topics', | |
31 | - }, | |
32 | - ), | |
33 | - ] |
courses/migrations/0008_auto_20160908_1332.py
... | ... | @@ -1,28 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-08 16:32 | |
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 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
14 | - ('courses', '0007_topic'), | |
15 | - ] | |
16 | - | |
17 | - operations = [ | |
18 | - migrations.AddField( | |
19 | - model_name='subject', | |
20 | - name='professors', | |
21 | - field=models.ManyToManyField(related_name='subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | |
22 | - ), | |
23 | - migrations.AddField( | |
24 | - model_name='topic', | |
25 | - name='owner', | |
26 | - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='topics', to=settings.AUTH_USER_MODEL, verbose_name='Owner'), | |
27 | - ), | |
28 | - ] |
courses/migrations/0009_auto_20160908_1625.py
... | ... | @@ -1,23 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-08 19:25 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -from django.db import migrations | |
6 | - | |
7 | - | |
8 | -class Migration(migrations.Migration): | |
9 | - | |
10 | - dependencies = [ | |
11 | - ('courses', '0008_auto_20160908_1332'), | |
12 | - ] | |
13 | - | |
14 | - operations = [ | |
15 | - migrations.AlterModelOptions( | |
16 | - name='subject', | |
17 | - options={'ordering': ('create_date',), 'verbose_name': 'Subject', 'verbose_name_plural': 'Subjects'}, | |
18 | - ), | |
19 | - migrations.AlterModelOptions( | |
20 | - name='topic', | |
21 | - options={'ordering': ('create_date',), 'verbose_name': 'Topic', 'verbose_name_plural': 'Topics'}, | |
22 | - ), | |
23 | - ] |
courses/migrations/0010_auto_20160914_2119.py
... | ... | @@ -1,42 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-15 00:19 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -import autoslug.fields | |
6 | -from django.conf import settings | |
7 | -from django.db import migrations, models | |
8 | - | |
9 | - | |
10 | -class Migration(migrations.Migration): | |
11 | - | |
12 | - dependencies = [ | |
13 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
14 | - ('courses', '0009_auto_20160908_1625'), | |
15 | - ] | |
16 | - | |
17 | - operations = [ | |
18 | - migrations.RemoveField( | |
19 | - model_name='course', | |
20 | - name='user', | |
21 | - ), | |
22 | - migrations.AddField( | |
23 | - model_name='course', | |
24 | - name='professors', | |
25 | - field=models.ManyToManyField(related_name='courses', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | |
26 | - ), | |
27 | - migrations.AlterField( | |
28 | - model_name='category', | |
29 | - name='slug', | |
30 | - field=autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug'), | |
31 | - ), | |
32 | - migrations.AlterField( | |
33 | - model_name='course', | |
34 | - name='name', | |
35 | - field=models.CharField(max_length=100, verbose_name='Name'), | |
36 | - ), | |
37 | - migrations.AlterField( | |
38 | - model_name='course', | |
39 | - name='slug', | |
40 | - field=autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug'), | |
41 | - ), | |
42 | - ] |
courses/migrations/0011_auto_20160914_2126.py
... | ... | @@ -1,49 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-15 00:26 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -from django.conf import settings | |
6 | -from django.db import migrations, models | |
7 | -import django.db.models.deletion | |
8 | - | |
9 | - | |
10 | -class Migration(migrations.Migration): | |
11 | - | |
12 | - dependencies = [ | |
13 | - ('courses', '0010_auto_20160914_2119'), | |
14 | - ] | |
15 | - | |
16 | - operations = [ | |
17 | - migrations.AlterModelOptions( | |
18 | - name='course', | |
19 | - options={'ordering': ('create_date', 'name'), 'verbose_name': 'Course', 'verbose_name_plural': 'Courses'}, | |
20 | - ), | |
21 | - migrations.AlterModelOptions( | |
22 | - name='subject', | |
23 | - options={'ordering': ('create_date', 'name'), 'verbose_name': 'Subject', 'verbose_name_plural': 'Subjects'}, | |
24 | - ), | |
25 | - migrations.AlterModelOptions( | |
26 | - name='topic', | |
27 | - options={'ordering': ('create_date', 'name'), 'verbose_name': 'Topic', 'verbose_name_plural': 'Topics'}, | |
28 | - ), | |
29 | - migrations.AlterField( | |
30 | - model_name='course', | |
31 | - name='category', | |
32 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Category', verbose_name='Category'), | |
33 | - ), | |
34 | - migrations.AlterField( | |
35 | - model_name='course', | |
36 | - name='image', | |
37 | - field=models.ImageField(blank=True, upload_to='courses/', verbose_name='Image'), | |
38 | - ), | |
39 | - migrations.AlterField( | |
40 | - model_name='subject', | |
41 | - name='visible', | |
42 | - field=models.BooleanField(default=False, verbose_name='Visible'), | |
43 | - ), | |
44 | - migrations.AlterField( | |
45 | - model_name='topic', | |
46 | - name='owner', | |
47 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topics', to=settings.AUTH_USER_MODEL, verbose_name='Owner'), | |
48 | - ), | |
49 | - ] |
courses/migrations/0012_course_students.py
... | ... | @@ -1,22 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-15 02:57 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -from django.conf import settings | |
6 | -from django.db import migrations, models | |
7 | - | |
8 | - | |
9 | -class Migration(migrations.Migration): | |
10 | - | |
11 | - dependencies = [ | |
12 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
13 | - ('courses', '0011_auto_20160914_2126'), | |
14 | - ] | |
15 | - | |
16 | - operations = [ | |
17 | - migrations.AddField( | |
18 | - model_name='course', | |
19 | - name='students', | |
20 | - field=models.ManyToManyField(related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | |
21 | - ), | |
22 | - ] |
courses/migrations/0013_auto_20160916_0001.py
... | ... | @@ -1,28 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-16 03:01 | |
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 | - ('courses', '0012_course_students'), | |
13 | - ] | |
14 | - | |
15 | - operations = [ | |
16 | - migrations.AddField( | |
17 | - model_name='subject', | |
18 | - name='end_date', | |
19 | - field=models.DateField(default=django.utils.timezone.now, verbose_name='End of Subject Date'), | |
20 | - preserve_default=False, | |
21 | - ), | |
22 | - migrations.AddField( | |
23 | - model_name='subject', | |
24 | - name='init_date', | |
25 | - field=models.DateField(default=django.utils.timezone.now, verbose_name='Begin of Subject Date'), | |
26 | - preserve_default=False, | |
27 | - ), | |
28 | - ] |
courses/migrations/0013_auto_20160916_0126.py
... | ... | @@ -1,48 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-16 04:26 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -from django.conf import settings | |
6 | -from django.db import migrations, models | |
7 | -import django.db.models.deletion | |
8 | - | |
9 | - | |
10 | -class Migration(migrations.Migration): | |
11 | - | |
12 | - dependencies = [ | |
13 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
14 | - ('core', '0009_auto_20160916_0126'), | |
15 | - ('courses', '0012_course_students'), | |
16 | - ] | |
17 | - | |
18 | - operations = [ | |
19 | - migrations.CreateModel( | |
20 | - name='Activity', | |
21 | - fields=[ | |
22 | - ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), | |
23 | - ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), | |
24 | - ('limit_date', models.DateTimeField(verbose_name='Deliver Date')), | |
25 | - ('grade', models.IntegerField(verbose_name='grade')), | |
26 | - ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student', to=settings.AUTH_USER_MODEL, verbose_name='student')), | |
27 | - ], | |
28 | - bases=('core.resource',), | |
29 | - ), | |
30 | - migrations.CreateModel( | |
31 | - name='Link', | |
32 | - fields=[ | |
33 | - ('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')), | |
34 | - ('url_field', models.CharField(max_length=300, verbose_name='url')), | |
35 | - ], | |
36 | - bases=('core.resource',), | |
37 | - ), | |
38 | - migrations.AddField( | |
39 | - model_name='topic', | |
40 | - name='visible', | |
41 | - field=models.BooleanField(default=False, verbose_name='Visible'), | |
42 | - ), | |
43 | - migrations.AddField( | |
44 | - model_name='activity', | |
45 | - name='topic', | |
46 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topic', to='courses.Topic', verbose_name='Topic'), | |
47 | - ), | |
48 | - ] |
courses/migrations/0014_merge_20160916_0255.py
... | ... | @@ -1,16 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-16 05:55 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -from django.db import migrations | |
6 | - | |
7 | - | |
8 | -class Migration(migrations.Migration): | |
9 | - | |
10 | - dependencies = [ | |
11 | - ('courses', '0013_auto_20160916_0001'), | |
12 | - ('courses', '0013_auto_20160916_0126'), | |
13 | - ] | |
14 | - | |
15 | - operations = [ | |
16 | - ] |
courses/models.py
... | ... | @@ -71,8 +71,8 @@ class Topic(models.Model): |
71 | 71 | description = models.TextField(_('Description'), blank = True) |
72 | 72 | create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) |
73 | 73 | update_date = models.DateTimeField(_('Date of last update'), auto_now=True) |
74 | - subject = models.ForeignKey(Subject, verbose_name = _('Subject'), related_name="topics") | |
75 | - owner = models.ForeignKey(User, verbose_name = _('Owner'), related_name="topics") | |
74 | + subject = models.ForeignKey(Subject, verbose_name = _('Subject')) | |
75 | + owner = models.ForeignKey(User, verbose_name = _('Owner')) | |
76 | 76 | visible = models.BooleanField(_('Visible'), default=False) |
77 | 77 | |
78 | 78 | class Meta: |
... | ... | @@ -89,14 +89,17 @@ Activity is something that has a deadline and has to be delivered by the student |
89 | 89 | """ |
90 | 90 | class Activity(Resource): |
91 | 91 | create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) |
92 | - topic = models.ForeignKey(Topic, verbose_name = _('Topic'), related_name="topic") | |
93 | - create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) | |
92 | + topic = models.ForeignKey(Topic, verbose_name = _('Topic')) | |
94 | 93 | limit_date = models.DateTimeField(_('Deliver Date')) |
95 | - student = models.ForeignKey(User, verbose_name = _('student'), related_name="student") | |
96 | - grade = models.IntegerField(_('grade')) | |
94 | + student = models.ForeignKey(User, verbose_name = _('student')) | |
95 | + | |
97 | 96 | |
98 | 97 | """ |
99 | -It is one kind of possible resources available inside a Topic. | |
98 | +It represents any Material inside a topic, be it a file, a link, etc. | |
100 | 99 | """ |
101 | -class Link(Resource): | |
102 | - url_field = models.CharField(_('url'), max_length= 300) | |
103 | 100 | \ No newline at end of file |
101 | +class Material(Resource): | |
102 | + create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) | |
103 | + topic = models.ForeignKey(Topic, verbose_name = _('Topic')) | |
104 | + student = models.ForeignKey(User, verbose_name = _('student')) | |
105 | + | |
106 | + | ... | ... |
courses/templates/course/create.html
... | ... | @@ -11,7 +11,6 @@ |
11 | 11 | {% endblock %} |
12 | 12 | |
13 | 13 | {% block content %} |
14 | -</br> | |
15 | 14 | <div class="card card-content"> |
16 | 15 | <div class="card-body"> |
17 | 16 | <form method="post" action="" enctype="multipart/form-data"> |
... | ... | @@ -59,6 +58,4 @@ |
59 | 58 | </div> |
60 | 59 | </div> |
61 | 60 | </br> |
62 | -</br> | |
63 | -</br> | |
64 | 61 | {% endblock %} | ... | ... |
courses/views.py
... | ... | @@ -15,6 +15,7 @@ from rolepermissions.verifications import has_object_permission |
15 | 15 | from .forms import CourseForm, UpdateCourseForm, CategoryForm, SubjectForm,TopicForm |
16 | 16 | from .models import Course, Subject, Category,Topic |
17 | 17 | from core.mixins import NotificationMixin |
18 | +from users.models import User | |
18 | 19 | |
19 | 20 | from datetime import date |
20 | 21 | |
... | ... | @@ -30,7 +31,7 @@ class IndexView(LoginRequiredMixin, NotificationMixin, generic.ListView): |
30 | 31 | def get_context_data(self, **kwargs): |
31 | 32 | context = super(IndexView, self).get_context_data(**kwargs) |
32 | 33 | context['categories'] = Category.objects.all() |
33 | - | |
34 | + super.createNotification(users= User.obejcts.all(), message="testando a notificacao em login") | |
34 | 35 | return context |
35 | 36 | |
36 | 37 | class CreateCourseView(LoginRequiredMixin, HasRoleMixin, NotificationMixin,generic.edit.CreateView): | ... | ... |
users/forms.py
users/migrations/0001_initial.py
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.9.7 on 2016-07-28 19:25 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -import django.contrib.auth.models | |
6 | -import django.core.validators | |
7 | -from django.db import migrations, models | |
8 | -import re | |
9 | - | |
10 | - | |
11 | -class Migration(migrations.Migration): | |
12 | - | |
13 | - initial = True | |
14 | - | |
15 | - dependencies = [ | |
16 | - ('auth', '0007_alter_validators_add_error_messages'), | |
17 | - ] | |
18 | - | |
19 | - operations = [ | |
20 | - migrations.CreateModel( | |
21 | - name='User', | |
22 | - fields=[ | |
23 | - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |
24 | - ('password', models.CharField(max_length=128, verbose_name='password')), | |
25 | - ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), | |
26 | - ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), | |
27 | - ('login', models.CharField(help_text='Um nome curto que será usado para identificá-lo de forma única na plataforma e também para acessá-la', max_length=35, unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[\\w.@+-]+$', 32), 'Informe um nome de usuário válido. Este valor deve conter apenas letras, números e os caracteres: @/./+/-/_ .', 'invalid')], verbose_name='Login')), | |
28 | - ('email', models.EmailField(max_length=254, unique=True, verbose_name='E-mail')), | |
29 | - ('name', models.CharField(blank=True, max_length=100, verbose_name='Nome')), | |
30 | - ('city', models.CharField(blank=True, max_length=90, verbose_name='Cidade')), | |
31 | - ('state', models.CharField(blank=True, max_length=30, verbose_name='Estado')), | |
32 | - ('gender', models.CharField(choices=[('M', 'Masculino'), ('F', 'Feminino')], max_length=1, verbose_name='Sexo')), | |
33 | - ('image', models.ImageField(blank=True, default='no_image.jpg', upload_to='users/', verbose_name='Imagem')), | |
34 | - ('birth_date', models.DateField(blank=True, verbose_name='Data de Nascimento')), | |
35 | - ('phone', models.CharField(blank=True, max_length=30, verbose_name='Telefone')), | |
36 | - ('cpf', models.CharField(blank=True, max_length=15, verbose_name='Cpf')), | |
37 | - ('type_profile', models.IntegerField(choices=[(1, 'Administrador'), (2, 'Professor'), (3, 'Aluno')], verbose_name='Tipo')), | |
38 | - ('date_created', models.DateTimeField(auto_now_add=True, verbose_name='Data de Cadastro')), | |
39 | - ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')), | |
40 | - ('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')), | |
41 | - ], | |
42 | - options={ | |
43 | - 'verbose_name_plural': 'Usuários', | |
44 | - 'verbose_name': 'Usuário', | |
45 | - }, | |
46 | - managers=[ | |
47 | - ('objects', django.contrib.auth.models.UserManager()), | |
48 | - ], | |
49 | - ), | |
50 | - ] | |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.10 on 2016-09-20 13:57 | |
3 | +from __future__ import unicode_literals | |
4 | + | |
5 | +import django.contrib.auth.models | |
6 | +import django.core.validators | |
7 | +from django.db import migrations, models | |
8 | +import re | |
9 | + | |
10 | + | |
11 | +class Migration(migrations.Migration): | |
12 | + | |
13 | + initial = True | |
14 | + | |
15 | + dependencies = [ | |
16 | + ('auth', '0008_alter_user_username_max_length'), | |
17 | + ] | |
18 | + | |
19 | + operations = [ | |
20 | + migrations.CreateModel( | |
21 | + name='User', | |
22 | + fields=[ | |
23 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |
24 | + ('password', models.CharField(max_length=128, verbose_name='password')), | |
25 | + ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), | |
26 | + ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), | |
27 | + ('username', models.CharField(help_text='A short name that will be used to identify you in the platform and to access it', max_length=35, unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[\\w.@+-]+$', 32), 'Type a valid username. This fields should only contain letters, numbers and the characteres: @/./+/-/_ .', 'invalid')], verbose_name='Login')), | |
28 | + ('email', models.EmailField(max_length=254, unique=True, verbose_name='Mail')), | |
29 | + ('name', models.CharField(blank=True, max_length=100, verbose_name='Name')), | |
30 | + ('city', models.CharField(blank=True, max_length=90, verbose_name='City')), | |
31 | + ('state', models.CharField(blank=True, max_length=30, verbose_name='State')), | |
32 | + ('gender', models.CharField(choices=[('M', 'Male'), ('F', 'Female')], max_length=1, verbose_name='Gender')), | |
33 | + ('image', models.ImageField(blank=True, upload_to='users/', verbose_name='Image')), | |
34 | + ('birth_date', models.DateField(blank=True, null=True, verbose_name='Birth Date')), | |
35 | + ('phone', models.CharField(blank=True, max_length=30, verbose_name='Phone')), | |
36 | + ('cpf', models.CharField(blank=True, max_length=15, verbose_name='Cpf')), | |
37 | + ('type_profile', models.IntegerField(blank=True, choices=[(1, 'Professor'), (2, 'Student')], default=2, null=True, verbose_name='Type')), | |
38 | + ('date_created', models.DateTimeField(auto_now_add=True, verbose_name='Create Date')), | |
39 | + ('is_staff', models.BooleanField(default=False, verbose_name='Administrador')), | |
40 | + ('is_active', models.BooleanField(default=True, verbose_name='Active')), | |
41 | + ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')), | |
42 | + ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), | |
43 | + ], | |
44 | + options={ | |
45 | + 'verbose_name': 'User', | |
46 | + 'verbose_name_plural': 'Users', | |
47 | + }, | |
48 | + managers=[ | |
49 | + ('objects', django.contrib.auth.models.UserManager()), | |
50 | + ], | |
51 | + ), | |
52 | + ] | ... | ... |
users/migrations/0002_auto_20160728_1629.py
... | ... | @@ -1,20 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.9.7 on 2016-07-28 19:29 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -from django.db import migrations | |
6 | - | |
7 | - | |
8 | -class Migration(migrations.Migration): | |
9 | - | |
10 | - dependencies = [ | |
11 | - ('users', '0001_initial'), | |
12 | - ] | |
13 | - | |
14 | - operations = [ | |
15 | - migrations.RenameField( | |
16 | - model_name='user', | |
17 | - old_name='login', | |
18 | - new_name='username', | |
19 | - ), | |
20 | - ] |
users/migrations/0003_auto_20160728_1631.py
... | ... | @@ -1,30 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.9.7 on 2016-07-28 19:31 | |
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_20160728_1629'), | |
12 | - ] | |
13 | - | |
14 | - operations = [ | |
15 | - migrations.AddField( | |
16 | - model_name='user', | |
17 | - name='is_active', | |
18 | - field=models.BooleanField(default=True, verbose_name='Ativo'), | |
19 | - ), | |
20 | - migrations.AddField( | |
21 | - model_name='user', | |
22 | - name='is_staff', | |
23 | - field=models.BooleanField(default=False, verbose_name='Administrador'), | |
24 | - ), | |
25 | - migrations.AlterField( | |
26 | - model_name='user', | |
27 | - name='type_profile', | |
28 | - field=models.IntegerField(choices=[(1, 'Professor'), (2, 'Aluno')], verbose_name='Tipo'), | |
29 | - ), | |
30 | - ] |
users/migrations/0004_auto_20160728_1634.py
... | ... | @@ -1,20 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.9.7 on 2016-07-28 19:34 | |
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', '0003_auto_20160728_1631'), | |
12 | - ] | |
13 | - | |
14 | - operations = [ | |
15 | - migrations.AlterField( | |
16 | - model_name='user', | |
17 | - name='birth_date', | |
18 | - field=models.DateField(blank=True, null=True, verbose_name='Data de Nascimento'), | |
19 | - ), | |
20 | - ] |
users/migrations/0005_auto_20160728_1636.py
... | ... | @@ -1,20 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.9.7 on 2016-07-28 19:36 | |
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', '0004_auto_20160728_1634'), | |
12 | - ] | |
13 | - | |
14 | - operations = [ | |
15 | - migrations.AlterField( | |
16 | - model_name='user', | |
17 | - name='type_profile', | |
18 | - field=models.IntegerField(blank=True, choices=[(1, 'Professor'), (2, 'Aluno')], null=True, verbose_name='Tipo'), | |
19 | - ), | |
20 | - ] |
users/migrations/0006_auto_20160815_0922.py
... | ... | @@ -1,81 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.9.7 on 2016-08-15 12:22 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -import django.core.validators | |
6 | -from django.db import migrations, models | |
7 | -import re | |
8 | - | |
9 | - | |
10 | -class Migration(migrations.Migration): | |
11 | - | |
12 | - dependencies = [ | |
13 | - ('users', '0005_auto_20160728_1636'), | |
14 | - ] | |
15 | - | |
16 | - operations = [ | |
17 | - migrations.AlterModelOptions( | |
18 | - name='user', | |
19 | - options={'verbose_name': 'User', 'verbose_name_plural': 'Users'}, | |
20 | - ), | |
21 | - migrations.AlterField( | |
22 | - model_name='user', | |
23 | - name='birth_date', | |
24 | - field=models.DateField(blank=True, null=True, verbose_name='Birth Date'), | |
25 | - ), | |
26 | - migrations.AlterField( | |
27 | - model_name='user', | |
28 | - name='city', | |
29 | - field=models.CharField(blank=True, max_length=90, verbose_name='City'), | |
30 | - ), | |
31 | - migrations.AlterField( | |
32 | - model_name='user', | |
33 | - name='date_created', | |
34 | - field=models.DateTimeField(auto_now_add=True, verbose_name='Create Date'), | |
35 | - ), | |
36 | - migrations.AlterField( | |
37 | - model_name='user', | |
38 | - name='email', | |
39 | - field=models.EmailField(max_length=254, unique=True, verbose_name='Mail'), | |
40 | - ), | |
41 | - migrations.AlterField( | |
42 | - model_name='user', | |
43 | - name='gender', | |
44 | - field=models.CharField(choices=[('M', 'Male'), ('F', 'Female')], max_length=1, verbose_name='Gender'), | |
45 | - ), | |
46 | - migrations.AlterField( | |
47 | - model_name='user', | |
48 | - name='image', | |
49 | - field=models.ImageField(blank=True, default='no_image.jpg', upload_to='users/', verbose_name='Image'), | |
50 | - ), | |
51 | - migrations.AlterField( | |
52 | - model_name='user', | |
53 | - name='is_active', | |
54 | - field=models.BooleanField(default=True, verbose_name='Active'), | |
55 | - ), | |
56 | - migrations.AlterField( | |
57 | - model_name='user', | |
58 | - name='name', | |
59 | - field=models.CharField(blank=True, max_length=100, verbose_name='Name'), | |
60 | - ), | |
61 | - migrations.AlterField( | |
62 | - model_name='user', | |
63 | - name='phone', | |
64 | - field=models.CharField(blank=True, max_length=30, verbose_name='Phone'), | |
65 | - ), | |
66 | - migrations.AlterField( | |
67 | - model_name='user', | |
68 | - name='state', | |
69 | - field=models.CharField(blank=True, max_length=30, verbose_name='State'), | |
70 | - ), | |
71 | - migrations.AlterField( | |
72 | - model_name='user', | |
73 | - name='type_profile', | |
74 | - field=models.IntegerField(blank=True, choices=[(1, 'Professor'), (2, 'Student')], null=True, verbose_name='Type'), | |
75 | - ), | |
76 | - migrations.AlterField( | |
77 | - model_name='user', | |
78 | - name='username', | |
79 | - field=models.CharField(help_text='A short name that will be used to identify you in the platform and to access it', max_length=35, unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[\\w.@+-]+$', 32), 'Type a valid username. This fields should only contain letters, numbers and the characteres: @/./+/-/_ .', 'invalid')], verbose_name='Login'), | |
80 | - ), | |
81 | - ] |
users/migrations/0007_auto_20160825_1801.py
... | ... | @@ -1,22 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-08-25 21:01 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -import django.core.validators | |
6 | -from django.db import migrations, models | |
7 | -import re | |
8 | - | |
9 | - | |
10 | -class Migration(migrations.Migration): | |
11 | - | |
12 | - dependencies = [ | |
13 | - ('users', '0006_auto_20160815_0922'), | |
14 | - ] | |
15 | - | |
16 | - operations = [ | |
17 | - migrations.AlterField( | |
18 | - model_name='user', | |
19 | - name='username', | |
20 | - field=models.CharField(help_text='A short name that will be used to identify you in the platform and to access it', max_length=35, unique=True, validators=[django.core.validators.RegexValidator(re.compile(b'^[\\w.@+-]+$'), 'Type a valid username. This fields should only contain letters, numbers and the characteres: @/./+/-/_ .', b'invalid')], verbose_name='Login'), | |
21 | - ), | |
22 | - ] |
users/migrations/0008_auto_20160902_2123.py
... | ... | @@ -1,27 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-03 00:23 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -import django.core.validators | |
6 | -from django.db import migrations, models | |
7 | -import re | |
8 | - | |
9 | - | |
10 | -class Migration(migrations.Migration): | |
11 | - | |
12 | - dependencies = [ | |
13 | - ('users', '0007_auto_20160825_1801'), | |
14 | - ] | |
15 | - | |
16 | - operations = [ | |
17 | - migrations.AlterField( | |
18 | - model_name='user', | |
19 | - name='type_profile', | |
20 | - field=models.IntegerField(blank=True, choices=[(1, 'Professor'), (2, 'Student')], default=2, null=True, verbose_name='Type'), | |
21 | - ), | |
22 | - migrations.AlterField( | |
23 | - model_name='user', | |
24 | - name='username', | |
25 | - field=models.CharField(help_text='A short name that will be used to identify you in the platform and to access it', max_length=35, unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[\\w.@+-]+$', 32), 'Type a valid username. This fields should only contain letters, numbers and the characteres: @/./+/-/_ .', 'invalid')], verbose_name='Login'), | |
26 | - ), | |
27 | - ] |
users/migrations/0009_auto_20160906_1450.py
... | ... | @@ -1,22 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-06 17:50 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -import django.core.validators | |
6 | -from django.db import migrations, models | |
7 | -import re | |
8 | - | |
9 | - | |
10 | -class Migration(migrations.Migration): | |
11 | - | |
12 | - dependencies = [ | |
13 | - ('users', '0008_auto_20160902_2123'), | |
14 | - ] | |
15 | - | |
16 | - operations = [ | |
17 | - migrations.AlterField( | |
18 | - model_name='user', | |
19 | - name='username', | |
20 | - field=models.CharField(help_text='A short name that will be used to identify you in the platform and to access it', max_length=35, unique=True, validators=[django.core.validators.RegexValidator(re.compile(b'^[\\w.@+-]+$'), 'Type a valid username. This fields should only contain letters, numbers and the characteres: @/./+/-/_ .', b'invalid')], verbose_name='Login'), | |
21 | - ), | |
22 | - ] |
users/migrations/0010_auto_20160906_2332.py
... | ... | @@ -1,22 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.9.7 on 2016-09-07 02:32 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -import django.core.validators | |
6 | -from django.db import migrations, models | |
7 | -import re | |
8 | - | |
9 | - | |
10 | -class Migration(migrations.Migration): | |
11 | - | |
12 | - dependencies = [ | |
13 | - ('users', '0009_auto_20160906_1450'), | |
14 | - ] | |
15 | - | |
16 | - operations = [ | |
17 | - migrations.AlterField( | |
18 | - model_name='user', | |
19 | - name='username', | |
20 | - field=models.CharField(help_text='A short name that will be used to identify you in the platform and to access it', max_length=35, unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[\\w.@+-]+$', 32), 'Type a valid username. This fields should only contain letters, numbers and the characteres: @/./+/-/_ .', 'invalid')], verbose_name='Login'), | |
21 | - ), | |
22 | - ] |
users/migrations/0011_auto_20160908_1108.py
... | ... | @@ -1,22 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-08 14:08 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -import django.core.validators | |
6 | -from django.db import migrations, models | |
7 | -import re | |
8 | - | |
9 | - | |
10 | -class Migration(migrations.Migration): | |
11 | - | |
12 | - dependencies = [ | |
13 | - ('users', '0010_auto_20160906_2332'), | |
14 | - ] | |
15 | - | |
16 | - operations = [ | |
17 | - migrations.AlterField( | |
18 | - model_name='user', | |
19 | - name='username', | |
20 | - field=models.CharField(help_text='A short name that will be used to identify you in the platform and to access it', max_length=35, unique=True, validators=[django.core.validators.RegexValidator(re.compile(b'^[\\w.@+-]+$'), 'Type a valid username. This fields should only contain letters, numbers and the characteres: @/./+/-/_ .', b'invalid')], verbose_name='Login'), | |
21 | - ), | |
22 | - ] |
users/migrations/0012_auto_20160908_1625.py
... | ... | @@ -1,22 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-08 19:25 | |
3 | -from __future__ import unicode_literals | |
4 | - | |
5 | -import django.core.validators | |
6 | -from django.db import migrations, models | |
7 | -import re | |
8 | - | |
9 | - | |
10 | -class Migration(migrations.Migration): | |
11 | - | |
12 | - dependencies = [ | |
13 | - ('users', '0011_auto_20160908_1108'), | |
14 | - ] | |
15 | - | |
16 | - operations = [ | |
17 | - migrations.AlterField( | |
18 | - model_name='user', | |
19 | - name='username', | |
20 | - field=models.CharField(help_text='A short name that will be used to identify you in the platform and to access it', max_length=35, unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[\\w.@+-]+$', 32), 'Type a valid username. This fields should only contain letters, numbers and the characteres: @/./+/-/_ .', 'invalid')], verbose_name='Login'), | |
21 | - ), | |
22 | - ] |
users/migrations/0013_auto_20160915_2334.py
... | ... | @@ -1,20 +0,0 @@ |
1 | -# -*- coding: utf-8 -*- | |
2 | -# Generated by Django 1.10 on 2016-09-16 02:34 | |
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', '0012_auto_20160908_1625'), | |
12 | - ] | |
13 | - | |
14 | - operations = [ | |
15 | - migrations.AlterField( | |
16 | - model_name='user', | |
17 | - name='image', | |
18 | - field=models.ImageField(blank=True, upload_to='users/', verbose_name='Image'), | |
19 | - ), | |
20 | - ] |
users/templates/users/profile.html
... | ... | @@ -41,7 +41,7 @@ |
41 | 41 | <div class="card-body"> |
42 | 42 | <div class="row"> |
43 | 43 | <div class="col-md-4"> |
44 | - <img src="{{ user.image.url }}" class="img-responsive center-block img-circle" alt="foto perfil" style="max-height:174px"> | |
44 | + <img src="{{ user.image_url }}" class="img-responsive center-block img-circle" alt="foto perfil" style="max-height:174px"> | |
45 | 45 | </div> |
46 | 46 | <div class="col-md-8"> |
47 | 47 | <table class="table table-hover table-edited"> | ... | ... |
users/views.py
... | ... | @@ -107,7 +107,7 @@ class Profile(LoginRequiredMixin, generic.DetailView): |
107 | 107 | |
108 | 108 | class EditProfile(LoginRequiredMixin, generic.UpdateView): |
109 | 109 | |
110 | - login_url = reverse_lazy("core:home") | |
110 | + login_url = reverse_lazy('core:home') | |
111 | 111 | redirect_field_name = 'next' |
112 | 112 | template_name = 'users/edit_profile.html' |
113 | 113 | form_class = UserForm |
... | ... | @@ -135,11 +135,12 @@ class EditProfile(LoginRequiredMixin, generic.UpdateView): |
135 | 135 | |
136 | 136 | |
137 | 137 | class UpdateUser(LoginRequiredMixin, generic.edit.UpdateView): |
138 | + | |
138 | 139 | allowed_roles = ['student'] |
139 | 140 | login_url = reverse_lazy("core:home") |
140 | 141 | template_name = 'users/edit_profile.html' |
141 | 142 | form_class = UpdateUserForm |
142 | - success_url = reverse_lazy('app:index') | |
143 | + success_url = reverse_lazy('users:update_profile') | |
143 | 144 | |
144 | 145 | def get_object(self): |
145 | 146 | user = get_object_or_404(User, username = self.request.user.username) | ... | ... |