Commit c48a43f8916c1052d87a119bcc618892d0835a1e

Authored by Matheus Lins
2 parents 17e3fac4 7d7c7583

updated migratioins

amadeus/settings.py
@@ -181,6 +181,14 @@ MESSAGE_TAGS = { @@ -181,6 +181,14 @@ MESSAGE_TAGS = {
181 messages_constants.ERROR: 'danger', 181 messages_constants.ERROR: 'danger',
182 } 182 }
183 183
  184 +#Send email for forgot Password
  185 +EMAIL_USE_TLS = True
  186 +EMAIL_HOST = 'smtp.gmail.com'
  187 +EMAIL_PORT = 25
  188 +EMAIL_HOST_USER = 'amadeusteste@gmail.com'
  189 +EMAIL_HOST_PASSWORD = 'amadeusteste'
  190 +# EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
  191 +
184 192
185 try: 193 try:
186 from .local_settings import * 194 from .local_settings import *
core/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-09-30 15:39 2 +# Generated by Django 1.10 on 2016-10-01 16:02
3 from __future__ import unicode_literals 3 from __future__ import unicode_literals
4 4
5 import autoslug.fields 5 import autoslug.fields
  6 +from django.conf import settings
6 from django.db import migrations, models 7 from django.db import migrations, models
7 import django.db.models.deletion 8 import django.db.models.deletion
8 9
@@ -12,6 +13,7 @@ class Migration(migrations.Migration): @@ -12,6 +13,7 @@ class Migration(migrations.Migration):
12 initial = True 13 initial = True
13 14
14 dependencies = [ 15 dependencies = [
  16 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
15 ] 17 ]
16 18
17 operations = [ 19 operations = [
@@ -31,6 +33,7 @@ class Migration(migrations.Migration): @@ -31,6 +33,7 @@ class Migration(migrations.Migration):
31 name='Action_Resource', 33 name='Action_Resource',
32 fields=[ 34 fields=[
33 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 35 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  36 + ('action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied')),
34 ], 37 ],
35 options={ 38 options={
36 'verbose_name': 'Action_Resource', 39 'verbose_name': 'Action_Resource',
@@ -42,6 +45,8 @@ class Migration(migrations.Migration): @@ -42,6 +45,8 @@ class Migration(migrations.Migration):
42 fields=[ 45 fields=[
43 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 46 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
44 ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), 47 ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')),
  48 + ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')),
  49 + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor')),
45 ], 50 ],
46 options={ 51 options={
47 'verbose_name': 'Log', 52 'verbose_name': 'Log',
@@ -56,6 +61,8 @@ class Migration(migrations.Migration): @@ -56,6 +61,8 @@ class Migration(migrations.Migration):
56 ('read', models.BooleanField(default=False, verbose_name='Read')), 61 ('read', models.BooleanField(default=False, verbose_name='Read')),
57 ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), 62 ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')),
58 ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')), 63 ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')),
  64 + ('actor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notification_Performer', to=settings.AUTH_USER_MODEL, verbose_name='Perfomer')),
  65 + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User')),
59 ], 66 ],
60 options={ 67 options={
61 'verbose_name': 'Notification', 68 'verbose_name': 'Notification',
@@ -76,4 +83,9 @@ class Migration(migrations.Migration): @@ -76,4 +83,9 @@ class Migration(migrations.Migration):
76 'verbose_name_plural': 'Resources', 83 'verbose_name_plural': 'Resources',
77 }, 84 },
78 ), 85 ),
  86 + migrations.AddField(
  87 + model_name='action_resource',
  88 + name='resource',
  89 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Resource', verbose_name='Resource'),
  90 + ),
79 ] 91 ]
core/migrations/0002_auto_20160930_1239.py
@@ -1,50 +0,0 @@ @@ -1,50 +0,0 @@
1 -# -*- coding: utf-8 -*-  
2 -# Generated by Django 1.10 on 2016-09-30 15:39  
3 -from __future__ import unicode_literals  
4 -  
5 -from django.conf import settings  
6 -from django.db import migrations, models  
7 -import django.db.models.deletion  
8 -  
9 -  
10 -class Migration(migrations.Migration):  
11 -  
12 - initial = True  
13 -  
14 - dependencies = [  
15 - ('core', '0001_initial'),  
16 - migrations.swappable_dependency(settings.AUTH_USER_MODEL),  
17 - ]  
18 -  
19 - operations = [  
20 - migrations.AddField(  
21 - model_name='notification',  
22 - name='actor',  
23 - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notification_Performer', to=settings.AUTH_USER_MODEL, verbose_name='Perfomer'),  
24 - ),  
25 - migrations.AddField(  
26 - model_name='notification',  
27 - name='user',  
28 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User'),  
29 - ),  
30 - migrations.AddField(  
31 - model_name='log',  
32 - name='action_resource',  
33 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource'),  
34 - ),  
35 - migrations.AddField(  
36 - model_name='log',  
37 - name='user',  
38 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor'),  
39 - ),  
40 - migrations.AddField(  
41 - model_name='action_resource',  
42 - name='action',  
43 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied'),  
44 - ),  
45 - migrations.AddField(  
46 - model_name='action_resource',  
47 - name='resource',  
48 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Resource', verbose_name='Resource'),  
49 - ),  
50 - ]  
core/templates/index.html
@@ -59,7 +59,7 @@ @@ -59,7 +59,7 @@
59 </div> 59 </div>
60 </form> 60 </form>
61 <div class="col-md-10 col-sm-10 col-xs-10 col-lg-10"> 61 <div class="col-md-10 col-sm-10 col-xs-10 col-lg-10">
62 - <a href="{% url 'core:remember_password' %}">{% trans "Forgot your password?" %}</a> 62 + <a href="{% url 'core:password_reset' %}">{% trans "Forgot your password?" %}</a>
63 </div> 63 </div>
64 {# </div> #} 64 {# </div> #}
65 {# <div class="row"> #} 65 {# <div class="row"> #}
core/templates/registration/passwor_reset_complete.html 0 → 100644
@@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
  1 +{% extends "index.html" %}
  2 +{% load i18n static %}
  3 +
  4 +{% block content %}
  5 +
  6 + <div class="row">
  7 + <div class="col-md-4 col-md-offset-4 col-xs-4 col-xs-offset-4 col-sm-4 col-sm-offset-4 col-lg-4 col-lg-offset-4 col-xl-4 col-xl-offset-4">
  8 + <div class="row">
  9 + <div class="col-md-offset-2 col-md-8 col-sm-offset-2 col-sm-8 col-xs-offset-2 col-xs-8 col-lg-offset-2 col-lg-8 col-xs-offset-2 col-xs-8">
  10 + </br>
  11 + </br>
  12 + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus">
  13 + </br>
  14 + </div>
  15 + </div>
  16 + </div>
  17 + <div class="row ">
  18 + <div class="col-lg-9 col-lg-offset-2 col-xs-9 col-xs-offset-2 col-sm-9 col-sm-offset-2 col-md-9 col-md-offset-2 col-xl-9 col-xl-offset-2">
  19 + <div class="card">
  20 + <div class="card-block">
  21 + <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12 col-xl-12">
  22 + <form class="form-group " method="post" action="">
  23 + {% csrf_token %}
  24 + <div class="form-group is-empty">
  25 + <p>
  26 + Sua senha foi definida. Você pode ir em frente e entrar agora.
  27 + </p>
  28 + </div>
  29 + </form>
  30 + </div>
  31 + </div>
  32 + </div>
  33 + </div>
  34 + </div>
  35 + </div>
  36 +
  37 +{% endblock content %}
core/templates/registration/passwor_reset_confirm.html 0 → 100644
@@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
  1 +{% extends "index.html" %}
  2 +{% load i18n static %}
  3 +
  4 +{% block content%}
  5 +
  6 + <div class="row">
  7 + <div class="col-md-4 col-md-offset-4 col-xs-4 col-xs-offset-4 col-sm-4 col-sm-offset-4 col-lg-4 col-lg-offset-4 col-xl-4 col-xl-offset-4">
  8 + <div class="row">
  9 + <div class="col-md-offset-2 col-md-8 col-sm-offset-2 col-sm-8 col-xs-offset-2 col-xs-8 col-lg-offset-2 col-lg-8 col-xs-offset-2 col-xs-8">
  10 + </br>
  11 + </br>
  12 + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus">
  13 + </br>
  14 + </div>
  15 + </div>
  16 + </div>
  17 + <div class="row ">
  18 + <div class="col-lg-9 col-lg-offset-2 col-xs-9 col-xs-offset-2 col-sm-9 col-sm-offset-2 col-md-9 col-md-offset-2 col-xl-9 col-xl-offset-2">
  19 +
  20 +
  21 + {% if validlink %}
  22 + <h3>Nova Senha</h3>
  23 + <form method="post">
  24 + {% csrf_token %}
  25 + {{ form.new_password1.erros }}
  26 + <label for="id_password1"> Nova Senha: </label>
  27 + {form.new_password1}
  28 +
  29 + {{ form.new_password2.erros }}
  30 + <label for="id_password2"> Confirmar Senha: </label>
  31 + {form.new_password2}
  32 +
  33 +
  34 + <button type="submit">Confirmar</button>
  35 + </form>
  36 +
  37 + {% else %}
  38 + <p>
  39 + O link de redefinição de senha está inválido, possivelmente porque ele já foi utilizado.
  40 + Por favor, solicite uma nova redefinição de senha.
  41 + </p>
  42 + {% endif %}
  43 +
  44 + </div>
  45 + </div>
  46 +</div>
  47 +
  48 +{% endblock content %}
core/templates/registration/passwor_reset_done.html 0 → 100644
@@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
  1 +{% extends "index.html" %}
  2 +{% load i18n static %}
  3 +
  4 +{% block content %}
  5 +
  6 + <div class="row">
  7 + <div class="col-md-4 col-md-offset-4 col-xs-4 col-xs-offset-4 col-sm-4 col-sm-offset-4 col-lg-4 col-lg-offset-4 col-xl-4 col-xl-offset-4">
  8 + <div class="row">
  9 + <div class="col-md-offset-2 col-md-8 col-sm-offset-2 col-sm-8 col-xs-offset-2 col-xs-8 col-lg-offset-2 col-lg-8 col-xs-offset-2 col-xs-8">
  10 + </br>
  11 + </br>
  12 + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus">
  13 + </br>
  14 + </div>
  15 + </div>
  16 + </div>
  17 + <div class="row ">
  18 + <div class="col-lg-9 col-lg-offset-2 col-xs-9 col-xs-offset-2 col-sm-9 col-sm-offset-2 col-md-9 col-md-offset-2 col-xl-9 col-xl-offset-2">
  19 + <div class="card">
  20 + <div class="card-block">
  21 + <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12 col-xl-12">
  22 + <form class="form-group " method="post" action="">
  23 + {% csrf_token %}
  24 + <div class="form-group is-empty">
  25 + <p>
  26 + Temos enviado instruções para configurar sua senha, se uma conta existe com o e-mail inserido.
  27 + Você deve recebê-los em breve.
  28 + </p>
  29 + <p>
  30 + Se você não receber um e-mail, por favor, certifique-se de que introduziu o endereço que você registrou,
  31 + e verifique a pasta de spam.
  32 + </p>
  33 + </div>
  34 + </form>
  35 + </div>
  36 + </div>
  37 + </div>
  38 + </div>
  39 + </div>
  40 +
  41 +{% endblock %}
core/templates/registration/passwor_reset_email.html 0 → 100644
@@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
  1 +To initiate the password reset process for your {{ user.get_username }} TestSite Account,
  2 +click the link below:
  3 +
  4 +{% block reset_link %}
  5 +{{ protocol }}://{{ domain }}{% url 'core:passwor_reset_confirm' uidb36=uid token=token %}
  6 +
  7 +{% endblock %}
  8 +
  9 +If clicking the link above doesn't work, please copy and paste the URL in a new browser
  10 +window instead.
  11 +
  12 +
  13 +Sincerely,
  14 +Amadeus.
core/templates/registration/passwor_reset_form.html 0 → 100644
@@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
  1 +{% extends "index.html" %}
  2 +{% load i18n static %}
  3 +
  4 +{% block content %}
  5 +
  6 + <div class="row">
  7 + < <div class="col-md-4 col-md-offset-4 col-xs-4 col-xs-offset-4 col-sm-4 col-sm-offset-4 col-lg-4 col-lg-offset-4 col-xl-4 col-xl-offset-4">
  8 + <div class="row">
  9 + <div class="col-md-offset-2 col-md-8 col-sm-offset-2 col-sm-8 col-xs-offset-2 col-xs-8 col-lg-offset-2 col-lg-8 col-xs-offset-2 col-xs-8">
  10 + </br>
  11 + </br>
  12 + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus">
  13 + </br>
  14 + </div>
  15 + </div>
  16 + </div>
  17 + <div class="row ">
  18 + <div class="col-lg-9 col-lg-offset-2 col-xs-9 col-xs-offset-2 col-sm-9 col-sm-offset-2 col-md-9 col-md-offset-2 col-xl-9 col-xl-offset-2">
  19 +
  20 +
  21 + <h3>Recuperar a senha</h3>
  22 + <form method="post">
  23 + {% csrf_token %}
  24 + <label for="id_email">E-mail: </label> {{ form.email }}
  25 + <input type="submit" value="Enviar" /></p>
  26 + </form>
  27 +
  28 + </div>
  29 + </div>
  30 + </div>
  31 +
  32 +{% endblock content %}
1 from django.conf.urls import url, include 1 from django.conf.urls import url, include
2 from django.contrib.auth import views as auth_views 2 from django.contrib.auth import views as auth_views
  3 +from django.contrib.auth.views import password_reset, password_reset_done,password_reset_confirm, password_reset_complete
3 4
4 from . import views 5 from . import views
5 6
@@ -11,4 +12,10 @@ urlpatterns = [ @@ -11,4 +12,10 @@ urlpatterns = [
11 url(r'^logout/$', auth_views.logout, {'next_page': 'core:home'}, name='logout'), 12 url(r'^logout/$', auth_views.logout, {'next_page': 'core:home'}, name='logout'),
12 url(r'^notification/([0-9]+)/$', views.processNotification, name='notification_read'), 13 url(r'^notification/([0-9]+)/$', views.processNotification, name='notification_read'),
13 url(r'^getNotifications/$', views.getNotifications, name='getNotifications'), 14 url(r'^getNotifications/$', views.getNotifications, name='getNotifications'),
  15 +
  16 + url(r'^reset/$', password_reset, {'template_name':'registration/passwor_reset_form.html','email_template_name':'registration/password_reset_email.html','post_reset_redirect':'done/'}, name="password_reset"),
  17 + url(r'^reset/done/$', password_reset_done, {'template_name':'registration/passwor_reset_done.html'}),
  18 + url(r'^reset/(?P<uidb36>[0-9A-Za-z]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', password_reset_confirm, {'template_name':'registration/password_reset_confirm.html'}),
  19 + url(r'^done/$', password_reset_complete,{'template_name':'registration/passwor_reset_complete.html'}),
  20 +
14 ] 21 ]
courses/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-09-30 15:39 2 +# Generated by Django 1.10 on 2016-10-01 16:02
3 from __future__ import unicode_literals 3 from __future__ import unicode_literals
4 4
5 import autoslug.fields 5 import autoslug.fields
  6 +from django.conf import settings
6 from django.db import migrations, models 7 from django.db import migrations, models
7 import django.db.models.deletion 8 import django.db.models.deletion
8 9
@@ -12,7 +13,8 @@ class Migration(migrations.Migration): @@ -12,7 +13,8 @@ class Migration(migrations.Migration):
12 initial = True 13 initial = True
13 14
14 dependencies = [ 15 dependencies = [
15 - ('core', '0002_auto_20160930_1239'), 16 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
  17 + ('core', '0001_initial'),
16 ] 18 ]
17 19
18 operations = [ 20 operations = [
@@ -22,6 +24,7 @@ class Migration(migrations.Migration): @@ -22,6 +24,7 @@ class Migration(migrations.Migration):
22 ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), 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')),
23 ('limit_date', models.DateTimeField(verbose_name='Deliver Date')), 25 ('limit_date', models.DateTimeField(verbose_name='Deliver Date')),
24 ('all_students', models.BooleanField(default=False, verbose_name='All Students')), 26 ('all_students', models.BooleanField(default=False, verbose_name='All Students')),
  27 + ('students', models.ManyToManyField(related_name='activities', to=settings.AUTH_USER_MODEL, verbose_name='Students')),
25 ], 28 ],
26 bases=('core.resource',), 29 bases=('core.resource',),
27 ), 30 ),
@@ -53,6 +56,9 @@ class Migration(migrations.Migration): @@ -53,6 +56,9 @@ class Migration(migrations.Migration):
53 ('init_date', models.DateField(verbose_name='Begin of Course Date')), 56 ('init_date', models.DateField(verbose_name='Begin of Course Date')),
54 ('end_date', models.DateField(verbose_name='End of Course Date')), 57 ('end_date', models.DateField(verbose_name='End of Course Date')),
55 ('image', models.ImageField(blank=True, upload_to='courses/', verbose_name='Image')), 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_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')),
56 ], 62 ],
57 options={ 63 options={
58 'ordering': ('create_date', 'name'), 64 'ordering': ('create_date', 'name'),
@@ -65,6 +71,7 @@ class Migration(migrations.Migration): @@ -65,6 +71,7 @@ class Migration(migrations.Migration):
65 fields=[ 71 fields=[
66 ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), 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')),
67 ('all_students', models.BooleanField(default=False, verbose_name='All Students')), 73 ('all_students', models.BooleanField(default=False, verbose_name='All Students')),
  74 + ('students', models.ManyToManyField(related_name='materials', to=settings.AUTH_USER_MODEL, verbose_name='Students')),
68 ], 75 ],
69 bases=('core.resource',), 76 bases=('core.resource',),
70 ), 77 ),
@@ -80,6 +87,8 @@ class Migration(migrations.Migration): @@ -80,6 +87,8 @@ class Migration(migrations.Migration):
80 ('end_date', models.DateField(verbose_name='End of Subject Date')), 87 ('end_date', models.DateField(verbose_name='End of Subject Date')),
81 ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), 88 ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')),
82 ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), 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')),
83 ], 92 ],
84 options={ 93 options={
85 'ordering': ('create_date', 'name'), 94 'ordering': ('create_date', 'name'),
@@ -94,6 +103,7 @@ class Migration(migrations.Migration): @@ -94,6 +103,7 @@ class Migration(migrations.Migration):
94 ('name', models.CharField(max_length=100, verbose_name='Name')), 103 ('name', models.CharField(max_length=100, verbose_name='Name')),
95 ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), 104 ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')),
96 ('description', models.TextField(blank=True, verbose_name='Description')), 105 ('description', models.TextField(blank=True, verbose_name='Description')),
  106 + ('subjects', models.ManyToManyField(to='courses.Subject')),
97 ], 107 ],
98 options={ 108 options={
99 'verbose_name': 'subject category', 109 'verbose_name': 'subject category',
@@ -110,6 +120,8 @@ class Migration(migrations.Migration): @@ -110,6 +120,8 @@ class Migration(migrations.Migration):
110 ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), 120 ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')),
111 ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), 121 ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')),
112 ('visible', models.BooleanField(default=False, verbose_name='Visible')), 122 ('visible', models.BooleanField(default=False, verbose_name='Visible')),
  123 + ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Owner')),
  124 + ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject')),
113 ], 125 ],
114 options={ 126 options={
115 'ordering': ('create_date', 'name'), 127 'ordering': ('create_date', 'name'),
@@ -117,4 +129,14 @@ class Migration(migrations.Migration): @@ -117,4 +129,14 @@ class Migration(migrations.Migration):
117 'verbose_name_plural': 'Topics', 129 'verbose_name_plural': 'Topics',
118 }, 130 },
119 ), 131 ),
  132 + migrations.AddField(
  133 + model_name='material',
  134 + name='topic',
  135 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'),
  136 + ),
  137 + migrations.AddField(
  138 + model_name='activity',
  139 + name='topic',
  140 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'),
  141 + ),
120 ] 142 ]
courses/migrations/0002_auto_20160930_1239.py
@@ -1,80 +0,0 @@ @@ -1,80 +0,0 @@
1 -# -*- coding: utf-8 -*-  
2 -# Generated by Django 1.10 on 2016-09-30 15:39  
3 -from __future__ import unicode_literals  
4 -  
5 -from django.conf import settings  
6 -from django.db import migrations, models  
7 -import django.db.models.deletion  
8 -  
9 -  
10 -class Migration(migrations.Migration):  
11 -  
12 - initial = True  
13 -  
14 - dependencies = [  
15 - migrations.swappable_dependency(settings.AUTH_USER_MODEL),  
16 - ('courses', '0001_initial'),  
17 - ]  
18 -  
19 - operations = [  
20 - migrations.AddField(  
21 - model_name='topic',  
22 - name='owner',  
23 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Owner'),  
24 - ),  
25 - migrations.AddField(  
26 - model_name='topic',  
27 - name='subject',  
28 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject'),  
29 - ),  
30 - migrations.AddField(  
31 - model_name='subjectcategory',  
32 - name='subjects',  
33 - field=models.ManyToManyField(to='courses.Subject'),  
34 - ),  
35 - migrations.AddField(  
36 - model_name='subject',  
37 - name='course',  
38 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course'),  
39 - ),  
40 - migrations.AddField(  
41 - model_name='subject',  
42 - name='professors',  
43 - field=models.ManyToManyField(related_name='subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors'),  
44 - ),  
45 - migrations.AddField(  
46 - model_name='material',  
47 - name='students',  
48 - field=models.ManyToManyField(related_name='materials', to=settings.AUTH_USER_MODEL, verbose_name='Students'),  
49 - ),  
50 - migrations.AddField(  
51 - model_name='material',  
52 - name='topic',  
53 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'),  
54 - ),  
55 - migrations.AddField(  
56 - model_name='course',  
57 - name='category',  
58 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Category', verbose_name='Category'),  
59 - ),  
60 - migrations.AddField(  
61 - model_name='course',  
62 - name='professors',  
63 - field=models.ManyToManyField(related_name='courses_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors'),  
64 - ),  
65 - migrations.AddField(  
66 - model_name='course',  
67 - name='students',  
68 - field=models.ManyToManyField(related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'),  
69 - ),  
70 - migrations.AddField(  
71 - model_name='activity',  
72 - name='students',  
73 - field=models.ManyToManyField(related_name='activities', to=settings.AUTH_USER_MODEL, verbose_name='Students'),  
74 - ),  
75 - migrations.AddField(  
76 - model_name='activity',  
77 - name='topic',  
78 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'),  
79 - ),  
80 - ]  
courses/templates/course/index.html
@@ -35,16 +35,19 @@ @@ -35,16 +35,19 @@
35 </div> 35 </div>
36 {% endfor %} 36 {% endfor %}
37 {% endif %} 37 {% endif %}
  38 +
  39 +
38 <div class="col-md-12"> 40 <div class="col-md-12">
39 <div class="input-group"> 41 <div class="input-group">
40 - <div class="form-group is-empty"><input type="search" class="form-control" placeholder="Search Courses"></div>  
41 - <span class="input-group-btn input-group-sm">  
42 - <button type="button" class="btn btn-fab btn-fab-mini">  
43 - <i class="material-icons">search</i>  
44 - </button>  
45 - </span>  
46 -</div> 42 + <div class="form-group is-empty"><input type="search" class="form-control" placeholder="Search Courses"></div>
  43 + <span class="input-group-btn input-group-sm">
  44 + <button type="button" class="btn btn-fab btn-fab-mini">
  45 + <i class="material-icons">search</i>
  46 + </button>
  47 + </span>
  48 + </div>
47 </div> 49 </div>
  50 +
48 {% if courses|length > 0 %} 51 {% if courses|length > 0 %}
49 {% for course in courses %} 52 {% for course in courses %}
50 <div class="col-md-12"> 53 <div class="col-md-12">
courses/templates/topic/index.html
@@ -80,13 +80,13 @@ @@ -80,13 +80,13 @@
80 <div class="container-fluid"> 80 <div class="container-fluid">
81 <div class="row"> 81 <div class="row">
82 <div class="col-md-4"> 82 <div class="col-md-4">
83 -  
84 <div class="form-group is-empty"> 83 <div class="form-group is-empty">
85 <input type="text" class="form-control col-md-8" placeholder="Search Student"> 84 <input type="text" class="form-control col-md-8" placeholder="Search Student">
86 </div> 85 </div>
87 86
88 - </div>  
89 - </div> 87 + </div>
  88 + </div>
  89 +
90 <div class="panel-group" id="accordion"> 90 <div class="panel-group" id="accordion">
91 <div class="panel panel-info"> 91 <div class="panel panel-info">
92 <div class="panel-heading"> 92 <div class="panel-heading">
@@ -102,87 +102,22 @@ @@ -102,87 +102,22 @@
102 <i class="fa fa-file-archive-o fa-lg" aria-hidden="true">Atividade.doc</i> 102 <i class="fa fa-file-archive-o fa-lg" aria-hidden="true">Atividade.doc</i>
103 103
104 </div> 104 </div>
105 - <div class="col-md-6">  
106 - <label> Nota:</label>  
107 - <input type="number" step="0.01">  
108 - </div> 105 + {% if user|has_role:'professor, system_admin' %}
  106 + <div class="col-md-6">
  107 + <label> Nota:</label>
  108 + <input type="number" step="0.01">
  109 + </div>
  110 + {% else %}
  111 + <input type="file" name="arquivos" class="btn btn-success" multiple/>
  112 + {% endif %}
109 </div> 113 </div>
110 </div> 114 </div>
111 </div> 115 </div>
112 </div> 116 </div>
113 - <div class="panel panel-info">  
114 - <div class="panel-heading">  
115 - <h4 class="panel-title">  
116 - <a data-toggle="collapse" data-parent="#accordion" href="#collapse2">  
117 - Aluno Joao<i class="fa fa-plus-square" aria-hidden="true"></i></a>  
118 - </h4>  
119 - </div>  
120 - <div id="collapse2" class="panel-collapse collapse">  
121 - <div class="panel-body">  
122 - <div class="row">  
123 - <div class="col-md-6">  
124 - <i class="fa fa-file-archive-o fa-lg" aria-hidden="true">Atividade.doc</i>  
125 -  
126 - </div>  
127 - <div class="col-md-6">  
128 - <label> Nota:</label>  
129 - <input type="number" step="0.01">  
130 - </div>  
131 - </div>  
132 -  
133 - </div>  
134 </div> 117 </div>
135 </div> 118 </div>
136 - <div class="panel panel-info">  
137 - <div class="panel-heading">  
138 - <h4 class="panel-title">  
139 - <a data-toggle="collapse" data-parent="#accordion" href="#collapse3">  
140 - Aluno Santos<i class="fa fa-plus-square" aria-hidden="true"></i></a>  
141 - </h4>  
142 - </div>  
143 - <div id="collapse3" class="panel-collapse collapse">  
144 - <div class="panel-body">  
145 - <div class="row">  
146 - <div class="col-md-6">  
147 - <i class="fa fa-file-archive-o fa-lg" aria-hidden="true">Atividade.doc</i>  
148 -  
149 - </div>  
150 - <div class="col-md-6">  
151 - <label> Nota:</label>  
152 - <input type="number" step="0.01">  
153 - </div>  
154 - </div>  
155 - </div>  
156 - </div>  
157 - </div>  
158 - <div class="panel panel-info">  
159 - <div class="panel-heading">  
160 - <h4 class="panel-title">  
161 - <a data-toggle="collapse" data-parent="#accordion" href="#collapse4">  
162 - Aluno Ruam<i class="fa fa-plus-square" aria-hidden="true"></i></a>  
163 - </h4>  
164 - </div>  
165 - <div id="collapse4" class="panel-collapse collapse">  
166 - <div class="panel-body">  
167 - <div class="row">  
168 - <div class="col-md-6">  
169 - <i class="fa fa-file-archive-o fa-lg" aria-hidden="true">Atividade.doc</i>  
170 -  
171 - </div>  
172 - <div class="col-md-6">  
173 - <label> Nota:</label>  
174 - <input type="number" step="0.01">  
175 - </div>  
176 - </div>  
177 -  
178 - </div>  
179 - </div>  
180 - </div>  
181 -  
182 -</div>  
183 -</div>  
184 -  
185 -</fieldset></form> 119 + </fieldset>
  120 + </form>
186 121
187 <ul class="pagination pagination-sm"> 122 <ul class="pagination pagination-sm">
188 <li class="disabled"><a href="javascript:void(0)">«</a></li> 123 <li class="disabled"><a href="javascript:void(0)">«</a></li>
forum/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-09-30 15:39 2 +# Generated by Django 1.10 on 2016-10-01 16:02
3 from __future__ import unicode_literals 3 from __future__ import unicode_literals
4 4
  5 +from django.conf import settings
5 from django.db import migrations, models 6 from django.db import migrations, models
6 import django.db.models.deletion 7 import django.db.models.deletion
7 8
@@ -11,7 +12,8 @@ class Migration(migrations.Migration): @@ -11,7 +12,8 @@ class Migration(migrations.Migration):
11 initial = True 12 initial = True
12 13
13 dependencies = [ 14 dependencies = [
14 - ('courses', '0002_auto_20160930_1239'), 15 + ('courses', '0001_initial'),
  16 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
15 ] 17 ]
16 18
17 operations = [ 19 operations = [
@@ -36,6 +38,8 @@ class Migration(migrations.Migration): @@ -36,6 +38,8 @@ class Migration(migrations.Migration):
36 ('message', models.TextField(verbose_name='Post message')), 38 ('message', models.TextField(verbose_name='Post message')),
37 ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), 39 ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')),
38 ('post_date', models.DateTimeField(auto_now_add=True, verbose_name='Post Date')), 40 ('post_date', models.DateTimeField(auto_now_add=True, verbose_name='Post Date')),
  41 + ('forum', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Forum', verbose_name='Forum')),
  42 + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor')),
39 ], 43 ],
40 options={ 44 options={
41 'verbose_name': 'Post', 45 'verbose_name': 'Post',
@@ -50,6 +54,7 @@ class Migration(migrations.Migration): @@ -50,6 +54,7 @@ class Migration(migrations.Migration):
50 ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), 54 ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')),
51 ('answer_date', models.DateTimeField(auto_now_add=True, verbose_name='Answer Date')), 55 ('answer_date', models.DateTimeField(auto_now_add=True, verbose_name='Answer Date')),
52 ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Post', verbose_name='Post')), 56 ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Post', verbose_name='Post')),
  57 + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor')),
53 ], 58 ],
54 options={ 59 options={
55 'verbose_name': 'Post Answer', 60 'verbose_name': 'Post Answer',
forum/migrations/0002_auto_20160930_1239.py
@@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
1 -# -*- coding: utf-8 -*-  
2 -# Generated by Django 1.10 on 2016-09-30 15:39  
3 -from __future__ import unicode_literals  
4 -  
5 -from django.conf import settings  
6 -from django.db import migrations, models  
7 -import django.db.models.deletion  
8 -  
9 -  
10 -class Migration(migrations.Migration):  
11 -  
12 - initial = True  
13 -  
14 - dependencies = [  
15 - migrations.swappable_dependency(settings.AUTH_USER_MODEL),  
16 - ('forum', '0001_initial'),  
17 - ]  
18 -  
19 - operations = [  
20 - migrations.AddField(  
21 - model_name='postanswer',  
22 - name='user',  
23 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor'),  
24 - ),  
25 - migrations.AddField(  
26 - model_name='post',  
27 - name='forum',  
28 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Forum', verbose_name='Forum'),  
29 - ),  
30 - migrations.AddField(  
31 - model_name='post',  
32 - name='user',  
33 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor'),  
34 - ),  
35 - ]  
poll/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-09-30 15:40 2 +# Generated by Django 1.10 on 2016-10-01 16:02
3 from __future__ import unicode_literals 3 from __future__ import unicode_literals
4 4
5 from django.db import migrations, models 5 from django.db import migrations, models
@@ -11,7 +11,7 @@ class Migration(migrations.Migration): @@ -11,7 +11,7 @@ class Migration(migrations.Migration):
11 initial = True 11 initial = True
12 12
13 dependencies = [ 13 dependencies = [
14 - ('courses', '0002_auto_20160930_1239'), 14 + ('courses', '0001_initial'),
15 ] 15 ]
16 16
17 operations = [ 17 operations = [
@@ -23,9 +23,9 @@ class Migration(migrations.Migration): @@ -23,9 +23,9 @@ class Migration(migrations.Migration):
23 ('order', models.PositiveSmallIntegerField(verbose_name='Order')), 23 ('order', models.PositiveSmallIntegerField(verbose_name='Order')),
24 ], 24 ],
25 options={ 25 options={
26 - 'verbose_name_plural': 'Answers',  
27 'ordering': ('order',), 26 'ordering': ('order',),
28 'verbose_name': 'Answer', 27 'verbose_name': 'Answer',
  28 + 'verbose_name_plural': 'Answers',
29 }, 29 },
30 ), 30 ),
31 migrations.CreateModel( 31 migrations.CreateModel(
@@ -34,8 +34,8 @@ class Migration(migrations.Migration): @@ -34,8 +34,8 @@ class Migration(migrations.Migration):
34 ('activity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='courses.Activity')), 34 ('activity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='courses.Activity')),
35 ], 35 ],
36 options={ 36 options={
37 - 'verbose_name_plural': 'Polls',  
38 'verbose_name': 'Poll', 37 'verbose_name': 'Poll',
  38 + 'verbose_name_plural': 'Polls',
39 }, 39 },
40 bases=('courses.activity',), 40 bases=('courses.activity',),
41 ), 41 ),
users/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-09-30 15:40 2 +# Generated by Django 1.10 on 2016-10-01 16:01
3 from __future__ import unicode_literals 3 from __future__ import unicode_literals
4 4
5 import django.contrib.auth.models 5 import django.contrib.auth.models