Commit 5964b15be32de53927ddf6656f2f7184191d1ec3

Authored by Gustavo Bernardo
2 parents 006ad08c 1f6ecdb9

Merge branch 'dev' of https://github.com/amadeusproject/amadeuslms into dev

app/templates/home.html
@@ -3,53 +3,55 @@ @@ -3,53 +3,55 @@
3 {% load static i18n django_bootstrap_breadcrumbs permission_tags %} 3 {% load static i18n django_bootstrap_breadcrumbs permission_tags %}
4 4
5 {% block javascript %} 5 {% block javascript %}
6 - <script type="text/javascript">  
7 - var pageNum = {{ page_obj.number }}; // The latest page loaded  
8 - var numberPages = {{ paginator.num_pages }}; // Indicates the number of pages  
9 - var baseUrl = '{% url "app:index" %}'; 6 + {% if page_obj %}
  7 + <script type="text/javascript">
  8 + var pageNum = {{ page_obj.number }}; // The latest page loaded
  9 + var numberPages = {{ paginator.num_pages }}; // Indicates the number of pages
  10 + var baseUrl = '{% url "app:index" %}';
10 11
11 - // loadOnScroll handler  
12 - var loadOnScroll = function() {  
13 - // If the current scroll position is past out cutoff point...  
14 - if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) {  
15 - // temporarily unhook the scroll event watcher so we don't call a bunch of times in a row  
16 - $(window).unbind();  
17 - // execute the load function below that will visit the view and return the content  
18 - loadItems();  
19 - }  
20 - }; 12 + // loadOnScroll handler
  13 + var loadOnScroll = function() {
  14 + // If the current scroll position is past out cutoff point...
  15 + if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) {
  16 + // temporarily unhook the scroll event watcher so we don't call a bunch of times in a row
  17 + $(window).unbind();
  18 + // execute the load function below that will visit the view and return the content
  19 + loadItems();
  20 + }
  21 + };
21 22
22 - var loadItems = function() {  
23 - // Check if page is equal to the number of pages  
24 - if (pageNum == numberPages) {  
25 - return false  
26 - }  
27 - // Update the page number  
28 - pageNum = pageNum + 1; 23 + var loadItems = function() {
  24 + // Check if page is equal to the number of pages
  25 + if (pageNum == numberPages) {
  26 + return false
  27 + }
  28 + // Update the page number
  29 + pageNum = pageNum + 1;
29 30
30 - $("#loading").show();  
31 - // Configure the url we're about to hit  
32 - setTimeout(function (){  
33 - $.ajax({  
34 - url: baseUrl,  
35 - data: {'page': pageNum},  
36 - success: function(data) {  
37 - $("#loading").hide(); 31 + $("#loading").show();
  32 + // Configure the url we're about to hit
  33 + setTimeout(function (){
  34 + $.ajax({
  35 + url: baseUrl,
  36 + data: {'page': pageNum},
  37 + success: function(data) {
  38 + $("#loading").hide();
38 39
39 - $("#timeline").append(data);  
40 - },  
41 - complete: function(data, textStatus){  
42 - // Turn the scroll monitor back on  
43 - $(window).bind('scroll', loadOnScroll);  
44 - }  
45 - });  
46 - }, 1000)  
47 - }; 40 + $("#timeline").append(data);
  41 + },
  42 + complete: function(data, textStatus){
  43 + // Turn the scroll monitor back on
  44 + $(window).bind('scroll', loadOnScroll);
  45 + }
  46 + });
  47 + }, 1000)
  48 + };
48 49
49 - $(document).ready(function(){  
50 - $(window).bind('scroll', loadOnScroll);  
51 - });  
52 - </script> 50 + $(document).ready(function(){
  51 + $(window).bind('scroll', loadOnScroll);
  52 + });
  53 + </script>
  54 + {% endif %}
53 {% endblock %} 55 {% endblock %}
54 56
55 {% block breadcrumbs %} 57 {% block breadcrumbs %}
@@ -73,6 +75,7 @@ @@ -73,6 +75,7 @@
73 {% if user|has_role:'student' or not user.is_staff %} 75 {% if user|has_role:'student' or not user.is_staff %}
74 <li><a href="{% url 'course:manage' %}">{% trans 'My courses' %}</a></li> 76 <li><a href="{% url 'course:manage' %}">{% trans 'My courses' %}</a></li>
75 {% endif %} 77 {% endif %}
  78 + <li><a href="{% url 'core:guest' %}">{% trans 'All Courses' %}</a></li>
76 {% if user|has_role:'system_admin' %} 79 {% if user|has_role:'system_admin' %}
77 <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li> 80 <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li>
78 {% endif %} 81 {% endif %}
app/templates/home_student.html
@@ -24,6 +24,7 @@ @@ -24,6 +24,7 @@
24 <ul class="nav nav-pills nav-stacked"> 24 <ul class="nav nav-pills nav-stacked">
25 <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> 25 <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>
26 <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li> 26 <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li>
  27 + <li><a href="{% url 'core:guest' %}">{% trans 'All Courses' %}</a></li>
27 <li><a href="javascript:void(0)">{% trans 'Google accounts' %}</a></li> 28 <li><a href="javascript:void(0)">{% trans 'Google accounts' %}</a></li>
28 </ul> 29 </ul>
29 </div> 30 </div>
app/templates/home_teacher_student_content.html
@@ -15,8 +15,8 @@ @@ -15,8 +15,8 @@
15 </div> 15 </div>
16 <div class="col-xs-10 col-md-11"> 16 <div class="col-xs-10 col-md-11">
17 <i class="fa fa-pencil-square-o" aria-hidden="true"></i> 17 <i class="fa fa-pencil-square-o" aria-hidden="true"></i>
18 - <a href=""><h4 class="resource_inline"><b>{{ notification.user }}</b></h4></a>  
19 - <p class="resource_inline">{{notification.message}} em : <a href="{% url 'core:notification_read' notification.id %}">Recurso</a></p> 18 + <h4 class="resource_inline"><b>{{ notification.actor }}</b></h4>
  19 + <p class="resource_inline">{{notification.message}} em : <a href="{% url 'core:notification_read' notification.id %}">{{ notification.action_resource.resource.name }}</a></p>
20 <p class="timePost"><i> {{ notification.datetime|timesince }} {% trans "ago" %} </i></p> 20 <p class="timePost"><i> {{ notification.datetime|timesince }} {% trans "ago" %} </i></p>
21 </div> 21 </div>
22 </div> 22 </div>
@@ -18,8 +18,6 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): @@ -18,8 +18,6 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin):
18 context_object_name = 'objects' 18 context_object_name = 'objects'
19 paginate_by = 10 19 paginate_by = 10
20 20
21 -  
22 -  
23 def get_queryset(self): 21 def get_queryset(self):
24 if self.request.user.is_staff: 22 if self.request.user.is_staff:
25 objects = Course.objects.all() 23 objects = Course.objects.all()
@@ -42,7 +40,7 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin): @@ -42,7 +40,7 @@ class AppIndex(LoginRequiredMixin, LogMixin, ListView, NotificationMixin):
42 else: 40 else:
43 self.template_name = "home_teacher_student_content.html" 41 self.template_name = "home_teacher_student_content.html"
44 42
45 - super(AppIndex, self).createNotification("testando notificacao de login", resource_name="home", resource_link="/") 43 + super(AppIndex, self).createNotification("you have just logged in", resource_name="home", resource_link="/")
46 return self.response_class(request = self.request, template = self.template_name, context = context, using = self.template_engine, **response_kwargs) 44 return self.response_class(request = self.request, template = self.template_name, context = context, using = self.template_engine, **response_kwargs)
47 45
48 46
core/decorators.py
@@ -60,7 +60,7 @@ def notification_decorator(read = False, message = &#39;&#39;, actor = None, users = [], @@ -60,7 +60,7 @@ def notification_decorator(read = False, message = &#39;&#39;, actor = None, users = [],
60 if action.exists(): 60 if action.exists():
61 action = action[0] 61 action = action[0]
62 else: 62 else:
63 - action = Action(name = not_action) 63 + action = Action(name = not_action)
64 action.save() 64 action.save()
65 65
66 if resource.exists(): 66 if resource.exists():
core/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-10-18 21:42 2 +# Generated by Django 1.10 on 2016-10-22 04:31
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 = [
@@ -20,21 +22,23 @@ class Migration(migrations.Migration): @@ -20,21 +22,23 @@ class Migration(migrations.Migration):
20 fields=[ 22 fields=[
21 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 23 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
22 ('name', models.CharField(max_length=100, verbose_name='Name')), 24 ('name', models.CharField(max_length=100, verbose_name='Name')),
  25 + ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from=('name',), unique=True, verbose_name='Slug')),
23 ('created_date', models.DateField(auto_now_add=True, verbose_name='Created Date')), 26 ('created_date', models.DateField(auto_now_add=True, verbose_name='Created Date')),
24 ], 27 ],
25 options={ 28 options={
26 - 'verbose_name': 'Action',  
27 'verbose_name_plural': 'Actions', 29 'verbose_name_plural': 'Actions',
  30 + 'verbose_name': 'Action',
28 }, 31 },
29 ), 32 ),
30 migrations.CreateModel( 33 migrations.CreateModel(
31 name='Action_Resource', 34 name='Action_Resource',
32 fields=[ 35 fields=[
33 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 36 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  37 + ('action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied')),
34 ], 38 ],
35 options={ 39 options={
36 - 'verbose_name': 'Action_Resource',  
37 'verbose_name_plural': 'Action_Resources', 40 'verbose_name_plural': 'Action_Resources',
  41 + 'verbose_name': 'Action_Resource',
38 }, 42 },
39 ), 43 ),
40 migrations.CreateModel( 44 migrations.CreateModel(
@@ -42,10 +46,12 @@ class Migration(migrations.Migration): @@ -42,10 +46,12 @@ class Migration(migrations.Migration):
42 fields=[ 46 fields=[
43 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 47 ('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')), 48 ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')),
  49 + ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')),
  50 + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor')),
45 ], 51 ],
46 options={ 52 options={
47 - 'verbose_name': 'Log',  
48 'verbose_name_plural': 'Logs', 53 'verbose_name_plural': 'Logs',
  54 + 'verbose_name': 'Log',
49 }, 55 },
50 ), 56 ),
51 migrations.CreateModel( 57 migrations.CreateModel(
@@ -56,8 +62,8 @@ class Migration(migrations.Migration): @@ -56,8 +62,8 @@ class Migration(migrations.Migration):
56 ('icon', models.CharField(max_length=50, unique=True, verbose_name='Icon')), 62 ('icon', models.CharField(max_length=50, unique=True, verbose_name='Icon')),
57 ], 63 ],
58 options={ 64 options={
59 - 'verbose_name': 'Amadeus Mime Type',  
60 'verbose_name_plural': 'Amadeus Mime Types', 65 'verbose_name_plural': 'Amadeus Mime Types',
  66 + 'verbose_name': 'Amadeus Mime Type',
61 }, 67 },
62 ), 68 ),
63 migrations.CreateModel( 69 migrations.CreateModel(
@@ -68,10 +74,12 @@ class Migration(migrations.Migration): @@ -68,10 +74,12 @@ class Migration(migrations.Migration):
68 ('read', models.BooleanField(default=False, verbose_name='Read')), 74 ('read', models.BooleanField(default=False, verbose_name='Read')),
69 ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), 75 ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')),
70 ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')), 76 ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')),
  77 + ('actor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notification_Performer', to=settings.AUTH_USER_MODEL, verbose_name='Perfomer')),
  78 + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User')),
71 ], 79 ],
72 options={ 80 options={
73 - 'verbose_name': 'Notification',  
74 'verbose_name_plural': 'Notifications', 81 'verbose_name_plural': 'Notifications',
  82 + 'verbose_name': 'Notification',
75 }, 83 },
76 ), 84 ),
77 migrations.CreateModel( 85 migrations.CreateModel(
@@ -84,8 +92,13 @@ class Migration(migrations.Migration): @@ -84,8 +92,13 @@ class Migration(migrations.Migration):
84 ('url', models.CharField(default='', max_length=100, verbose_name='URL')), 92 ('url', models.CharField(default='', max_length=100, verbose_name='URL')),
85 ], 93 ],
86 options={ 94 options={
87 - 'verbose_name': 'Resource',  
88 'verbose_name_plural': 'Resources', 95 'verbose_name_plural': 'Resources',
  96 + 'verbose_name': 'Resource',
89 }, 97 },
90 ), 98 ),
  99 + migrations.AddField(
  100 + model_name='action_resource',
  101 + name='resource',
  102 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Resource', verbose_name='Resource'),
  103 + ),
91 ] 104 ]
core/migrations/0002_auto_20161018_1842.py
@@ -1,50 +0,0 @@ @@ -1,50 +0,0 @@
1 -# -*- coding: utf-8 -*-  
2 -# Generated by Django 1.10 on 2016-10-18 21:42  
3 -from __future__ import unicode_literals  
4 -  
5 -from django.conf import settings  
6 -from django.db import migrations, models  
7 -import django.db.models.deletion  
8 -  
9 -  
10 -class Migration(migrations.Migration):  
11 -  
12 - initial = True  
13 -  
14 - dependencies = [  
15 - migrations.swappable_dependency(settings.AUTH_USER_MODEL),  
16 - ('core', '0001_initial'),  
17 - ]  
18 -  
19 - operations = [  
20 - migrations.AddField(  
21 - model_name='notification',  
22 - name='actor',  
23 - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notification_Performer', to=settings.AUTH_USER_MODEL, verbose_name='Perfomer'),  
24 - ),  
25 - migrations.AddField(  
26 - model_name='notification',  
27 - name='user',  
28 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User'),  
29 - ),  
30 - migrations.AddField(  
31 - model_name='log',  
32 - name='action_resource',  
33 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource'),  
34 - ),  
35 - migrations.AddField(  
36 - model_name='log',  
37 - name='user',  
38 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor'),  
39 - ),  
40 - migrations.AddField(  
41 - model_name='action_resource',  
42 - name='action',  
43 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied'),  
44 - ),  
45 - migrations.AddField(  
46 - model_name='action_resource',  
47 - name='resource',  
48 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Resource', verbose_name='Resource'),  
49 - ),  
50 - ]  
core/migrations/0002_auto_20161022_0158.py 0 → 100644
@@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
  1 +# -*- coding: utf-8 -*-
  2 +# Generated by Django 1.10 on 2016-10-22 04:58
  3 +from __future__ import unicode_literals
  4 +
  5 +import autoslug.fields
  6 +from django.db import migrations
  7 +
  8 +
  9 +class Migration(migrations.Migration):
  10 +
  11 + dependencies = [
  12 + ('core', '0001_initial'),
  13 + ]
  14 +
  15 + operations = [
  16 + migrations.AlterField(
  17 + model_name='action',
  18 + name='slug',
  19 + field=autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug'),
  20 + ),
  21 + ]
core/mixins.py
@@ -41,16 +41,16 @@ class LogMixin(object): @@ -41,16 +41,16 @@ class LogMixin(object):
41 class NotificationMixin(object): 41 class NotificationMixin(object):
42 message = "" 42 message = ""
43 read = False 43 read = False
44 - action_name = '' 44 + action_slug = ''
45 resource_name = '' 45 resource_name = ''
46 46
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) 47 + def createNotification(self, message='', actor=None, users = User.objects.all(), resource_slug='' ,action_slug = '', resource_name='', resource_link=''): #the default will be a broadcast
  48 + action = Action.objects.filter(slug = action_slug)
49 resource = Resource.objects.filter(slug = resource_slug) 49 resource = Resource.objects.filter(slug = resource_slug)
50 if action.exists(): 50 if action.exists():
51 action = action[0] 51 action = action[0]
52 else: 52 else:
53 - action = Action(name = self.action_name) 53 + action = Action(name = self.action_slug)
54 action.save() 54 action.save()
55 55
56 if resource.exists(): 56 if resource.exists():
@@ -76,3 +76,9 @@ class NotificationMixin(object): @@ -76,3 +76,9 @@ class NotificationMixin(object):
76 """ 76 """
77 Not quite sure how to do about it""" 77 Not quite sure how to do about it"""
78 return super(NotificationMixin, self).dispatch(request, *args, **kwargs) 78 return super(NotificationMixin, self).dispatch(request, *args, **kwargs)
  79 +
  80 + def createorRetrieveAction(self, action_name):
  81 + action = Action.objects.filter(name=action_name)
  82 + if action is None:
  83 + action = Action(name=action_name)
  84 + return action
79 \ No newline at end of file 85 \ No newline at end of file
core/models.py
@@ -25,6 +25,7 @@ class Action(models.Model): @@ -25,6 +25,7 @@ class Action(models.Model):
25 """ 25 """
26 26
27 name = models.CharField(_('Name'), max_length = 100) 27 name = models.CharField(_('Name'), max_length = 100)
  28 + slug = AutoSlugField(_("Slug"), populate_from=('name'), unique=True)
28 created_date = models.DateField(_('Created Date'), auto_now_add=True) 29 created_date = models.DateField(_('Created Date'), auto_now_add=True)
29 30
30 class Meta: 31 class Meta:
@@ -84,7 +85,7 @@ class Notification(models.Model): @@ -84,7 +85,7 @@ class Notification(models.Model):
84 @action_resource: The Object that holds the information about which action was perfomed on the Resource 85 @action_resource: The Object that holds the information about which action was perfomed on the Resource
85 @actor: The user who applied the action 86 @actor: The user who applied the action
86 """ 87 """
87 - 88 +
88 message = models.TextField(_('Message')) 89 message = models.TextField(_('Message'))
89 user = models.ForeignKey(User, related_name = _('%(class)s_Actor'), verbose_name= _('User')) 90 user = models.ForeignKey(User, related_name = _('%(class)s_Actor'), verbose_name= _('User'))
90 read = models.BooleanField(_('Read'), default = False) 91 read = models.BooleanField(_('Read'), default = False)
core/static/css/base/amadeus.css
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 #notification-dropdown{ 12 #notification-dropdown{
13 max-height: 500%; 13 max-height: 500%;
14 overflow: auto; 14 overflow: auto;
15 - width: 200px; 15 + width: 300px;
16 } 16 }
17 17
18 /* HEADER */ 18 /* HEADER */
@@ -351,5 +351,17 @@ ul, li { @@ -351,5 +351,17 @@ ul, li {
351 padding-bottom: 10px; 351 padding-bottom: 10px;
352 } 352 }
353 .form-group{ 353 .form-group{
354 - margin-top: 5px; 354 + margin-top: 10px;
  355 +}
  356 +
  357 +/* core/register_user.html classes*/
  358 +
  359 +.block-register-inline{
  360 + float: left;
  361 + display: inline-block;
  362 +}
  363 +
  364 +/* core/reset_password.html classes*/
  365 +.send-reset-email{
  366 + float: right;
355 } 367 }
356 \ No newline at end of file 368 \ No newline at end of file
core/templates/guest.html
1 -{% extends 'base.html' %} 1 +<!DOCTYPE html>
2 2
  3 +{% load static i18n %}
3 {% load i18n custom_filters %} 4 {% load i18n custom_filters %}
4 5
5 -{% block breadcrumbs %}  
6 - <div class="col-md-12">  
7 - <form id="searchform" action="{% url 'course:manage' %}" method="get" accept-charset="utf-8">  
8 - <div class="input-group">  
9 - <div class="form-group is-empty">  
10 - <input type="search" class="form-control" placeholder="Search Courses" name="q" id="searchbox"></div>  
11 - <span class="input-group-btn input-group-sm">  
12 - <button type="button" class="btn btn-fab btn-fab-mini">  
13 - <i class="material-icons">search</i>  
14 - </button>  
15 - </span>  
16 - </div>  
17 - </form>  
18 - </div>  
19 -  
20 - <div class="col-md-12">  
21 - <div class="btn-group btn-group-justified btn-group-raised">  
22 - <a href="?category=all" class="btn btn-raised btn-info">Todos</a>  
23 - {% for category_course in categorys_courses %}  
24 - <a href="?category={{category_course.name}}" class="btn btn-raised btn-primary">{{category_course.name}}</a>  
25 - {% endfor %}  
26 - </div>  
27 - </div> 6 +<html>
  7 +<head>
  8 + <title>{{ title }}</title>
  9 +
  10 + <meta http-equiv="Cache-Control" content="no-cache, no-store" />
  11 + <link href="{% static 'img/favicon.ico' %}" rel="shortcut icon" />
  12 + <!-- Roboto font -->
  13 + <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,500,700" type="text/css">
  14 + <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  15 +
  16 + <!-- jQuery & jQuery UI -->
  17 + <script type="text/javascript" src="{% static 'js/vendor/jquery-3.1.0.min.js' %}"></script>
  18 + <script type="text/javascript" src="{% static 'js/vendor/jquery-ui.js' %}"></script>
  19 +
  20 + <!-- Bootstrap and themes (material) -->
  21 + <link rel="stylesheet" type="text/css" href="{% static 'bootstrap-3.3.7/css/bootstrap.css' %}">
  22 + <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/material.min.css' %}">
  23 + <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/ripples.min.css' %}">
  24 + <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/datepicker.css' %}">
  25 + <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/alertifyjs/alertify.min.css' %}">
  26 + <link rel="stylesheet" type="text/css" href="{% static 'css/vendor/alertifyjs/themes/bootstrap.css' %}">
  27 + <script type="text/javascript" src="{% static 'bootstrap-3.3.7/js/bootstrap.js' %}"></script>
  28 + <script type="text/javascript" src="{% static 'js/vendor/bootstrap-acessibility.min.js' %}"></script>
  29 + <script type="text/javascript" src="{% static 'js/vendor/material.min.js' %}"></script>
  30 + <script type="text/javascript" src="{% static 'js/vendor/ripples.min.js' %}"></script>
  31 + <script type="text/javascript" src="{% static 'js/vendor/bootstrap-datepicker.js' %}"></script>
  32 + <script type="text/javascript" src="{% static 'js/vendor/alertify.min.js' %}"></script>
  33 +
  34 + <!-- Font awesome -->
  35 + <link rel="stylesheet" type="text/css" href="{% static 'font-awesome-4.6.3/css/font-awesome.min.css' %}">
  36 +
  37 + <!-- Custom styles -->
  38 + <link rel="stylesheet" type="text/css" href="{% static 'css/base/amadeus.css' %}">
  39 +
  40 + <!-- Init material Bootstrap -->
  41 + <script type="text/javascript">$.material.init()</script>
  42 +
  43 + <!--Javascript block for specific-app ones -->
  44 + <script src="{% static 'js/base/amadeus.js' %}"></script>
  45 + {% block style %}
  46 + {% endblock %}
  47 + {% block javascript %}
  48 + <script type="text/javascript" src="{% static 'js/course.js' %}"></script>
  49 + {% endblock %}
  50 +</head>
  51 +<body>
  52 + {% block nav %}
  53 + <div class="navbar navbar-default">
  54 + <div class="navbar-header">
  55 + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
  56 + <span class="icon-bar"></span>
  57 + <span class="icon-bar"></span>
  58 + <span class="icon-bar"></span>
  59 + </button>
  60 + <a class="navbar-brand" href="{% url 'app:index' %}"><img class="logo" src="{% static 'img/topo-amadeus-white.png' %}" alt="Logo"/></a>
  61 + </div>
  62 + <div class="navbar-collapse collapse navbar-responsive-collapse">
  63 + <ul class="nav navbar-nav navbar-right notifications">
  64 + <li class="" data-toggle="tooltip" data-placement="bottom" title data-original-title="notifications">
  65 + <a class="dropdown-toggle" data-toggle="dropdown"> <span id="notification-count" class="badge notification-count">{{notifications.count}}</span><i class="fa fa-bell" aria-hidden="true"></i></a>
  66 + <ul id="notification-dropdown" class="dropdown-menu">
  67 + <li class="dropdown-header">Notifications</li>
  68 + {% include "notifications.html" %}
  69 +
  70 + <li>
  71 + <a onclick="getNotifications(5)">
  72 + <div id="notification-see-more" class="list-group-item">
  73 + <div class="row-content">
  74 + <p class="list-group-item-text">See More</p>
  75 + </div>
  76 + </a>
  77 + </li>
  78 + </ul>
  79 + </li>
  80 +
  81 + <li data-toggle="tooltip" data-placement="bottom" title data-original-title="{% trans 'messages' %}"> <a href="#"><i class="fa fa-comments" aria-hidden="true"></i></a> </li>
  82 + <li > <a class="link" href="{% url 'app:index' %}">{{ user }}</a></li>
  83 +
  84 + </ul>
  85 + </div>
  86 + </div>
  87 + {% endblock %}
  88 + <div class="container-fluid">
  89 + <div class="row">
  90 +
  91 + <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 col-xl-2">
  92 + {% block sidebar %}
  93 + <div class="panel panel-primary navigation">
  94 + <div class="panel-heading">
  95 + <h4>Menu</h4>
  96 + </div>
  97 + <div class="panel-body">
  98 + <ul class="nav nav-pills nav-stacked">
  99 + <li><a href="{% url 'core:register' %}">{% trans 'Register' %}</a></li>
  100 + </ul>
  101 + </div>
  102 + </div>
  103 + {% endblock %}
  104 +
  105 + </div>
  106 + <div class="col-xs-10 col-sm-10 col-md-10 col-lg-10 col-xl-10">
  107 + {% block breadcrumbs %}
  108 + <div class="col-md-12">
  109 + <form id="searchform" action="{% url 'course:manage' %}" method="get" accept-charset="utf-8">
  110 + <div class="input-group">
  111 + <div class="form-group is-empty">
  112 + <input type="search" class="form-control" placeholder="Search Courses" name="q" id="searchbox"></div>
  113 + <span class="input-group-btn input-group-sm">
  114 + <button type="button" class="btn btn-fab btn-fab-mini">
  115 + <i class="material-icons">search</i>
  116 + </button>
  117 + </span>
  118 + </div>
  119 + </form>
  120 + </div>
28 121
29 -{% endblock %}  
30 -  
31 -  
32 -{% block content %}  
33 -  
34 - {% for course in courses %}  
35 - <div class="panel panel-info">  
36 - <div class="panel-heading">  
37 - <h3 class="panel-title">  
38 - {{course.name}}  
39 - {% if user|show_course_subscribe:course %}  
40 - <div class="pull-right" style="margin-top:-15px">  
41 - <a onclick="subscribe($(this), '{% url 'course:subscribe' course.slug %}' , '{% trans 'Are you sure you want to subscribe to this subject?' %}')" class="btn btn-sm btn-primary btn-raised">{% trans 'Subscribe' %}</a>  
42 - </div>  
43 - {% endif %}  
44 - </h3>  
45 - </div>  
46 -  
47 - <div class="panel-body">  
48 - <p><b>Course Name: </b>{{course.name}}</p>  
49 - <p><b>Begining: </b>{{course.init_date}}</p>  
50 - <p><b>End: </b>{{course.end_date}}</p>  
51 - <p><b>Professor: </b>{{course.professors.name}}</p>  
52 - <p>  
53 - <b>Description:</b>  
54 - <i>  
55 - {{course.content}}  
56 - </i>  
57 - </p>  
58 - </div>  
59 - </div>  
60 - {% endfor %}  
61 -{% endblock %}  
62 -  
63 -  
64 -  
65 -{% comment %}  
66 -  
67 -  
68 -  
69 -  
70 -</fieldset>  
71 - <div class="col-md-12">  
72 - {% if courses|length > 0 %}  
73 - {% if request.GET.category == 'all' or none or request.GET.category == '' %}  
74 - {% for course in list_courses %}  
75 - <div class="panel-group ui-accordion ui-widget ui-helper-reset ui-sortable" id="accordion" role="tablist" aria-multiselectable="false">  
76 - <div class="group">  
77 - <div class="panel panel-info">  
78 - <div class="panel-heading" role="tab">  
79 - <div class="row">  
80 - <div class="col-xs-9 col-md-9 titleTopic">  
81 - <a role="button" data-toggle="collapse" data-parent="#accordion" href=".collapseOne" aria-expanded="false" aria-controls="collapseOne" class="collapsed">  
82 - <h4 style="color:white">{{course.name}}</h4>  
83 - </a>  
84 - </div>  
85 - </div>  
86 - </div>  
87 - <div class="panel-collapse collapseOne collapse in" role="tabpanel" aria-labelledby="headingOne" aria-expanded="true" aria-hidden="false" tabindex="0">  
88 - <div class="panel-body">  
89 - <p><b>Course Name: </b>{{course.name}}</p>  
90 - <p><b>Duration (in semesters): </b>09</p>  
91 - <p><b>Coordinator: </b>{{course.professors}}</p>  
92 - <p>  
93 - <b>Description:</b>  
94 - <i>  
95 - {{course.description}}  
96 - </i>  
97 - </p>  
98 - <a href="{% url 'course:view' course.slug %}" class="btn btn-raised btn-default center-block">'View Course<div class="ripple-container"></div></a>  
99 - </div>  
100 - </div>  
101 - </div> 122 + <div class="col-md-12">
  123 + <div class="btn-group btn-group-justified btn-group-raised">
  124 + <a href="?category=all" class="btn btn-raised btn-info">Todos</a>
  125 + {% for category in categories %}
  126 + <a href="?category={{category.name}}" class="btn btn-raised btn-primary">{{category.name}}</a>
  127 + {% endfor %}
102 </div> 128 </div>
103 </div> 129 </div>
104 - {% endfor %}  
105 - {% else %}  
106 - {% for course in courses_category %}  
107 - {% if course.category.name == request.GET.category %}  
108 - <!-- Put your content here! -->  
109 - <div class="panel-group ui-accordion ui-widget ui-helper-reset ui-sortable" id="accordion" role="tablist" aria-multiselectable="false">  
110 - <div class="group">  
111 - <div class="panel panel-info">  
112 - <div class="panel-heading" role="tab">  
113 - <div class="row">  
114 - <div class="col-xs-9 col-md-9 titleTopic">  
115 - <a role="button" data-toggle="collapse" data-parent="#accordion" href=".collapseOne" aria-expanded="false" aria-controls="collapseOne" class="collapsed">  
116 - <h4 style="color:white">{{course.name}}</h4>  
117 - </a>  
118 - </div>  
119 - </div>  
120 - </div>  
121 - <div class="panel-collapse collapseOne collapse in" role="tabpanel" aria-labelledby="headingOne" aria-expanded="true" aria-hidden="false" tabindex="0">  
122 - <div class="panel-body">  
123 - <p><b>Course Name: </b>{{course.name}}</p>  
124 - <p><b>Duration (in semesters): </b>09</p>  
125 - <p><b>Coordinator: </b>{{course.professors}}</p>  
126 - <p>  
127 - <b>Description:</b>  
128 - <i>  
129 - {{course.description}}  
130 - </i>  
131 - </p>  
132 - <a href="{% url 'course:view' course.slug %}" class="btn btn-raised btn-default center-block">View Course<div class="ripple-container"></div></a>  
133 - </div>  
134 - </div> 130 +
  131 + {% endblock %}
  132 + {% block render_breadcrumbs %}{% endblock %}
  133 + <div>
  134 + </div>
  135 + <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
  136 + {% block content %}
  137 + {% for course in courses %}
  138 + <div class="panel panel-info panel_{{ course.id }}">
  139 + <div class="panel-heading">
  140 + <a href="{{ course.get_absolute_url }}" class="panel-title">{{course.name}}</a>
  141 + {% if user|show_course_subscribe:course %}
  142 + <a onclick="subscribe($(this), '{% url 'course:subscribe' course.slug %}', {{ course.id}}, '{% trans 'Are you sure you want to subscribe to this course?' %}')" class="btn btn-sm btn-primary btn-raised pull-right" style="margin-top:-4px">{% trans 'Subscribe' %}</a>
  143 + {% endif %}
  144 + </div>
  145 +
  146 + <div class="panel-body">
  147 + <p><b>Course Name: </b>{{course.name}}</p>
  148 + <p><b>Begining: </b>{{course.init_date}}</p>
  149 + <p><b>End: </b>{{course.end_date}}</p>
  150 + <p><b>Professor: </b>{{course.professors.name}}</p>
  151 + <p>
  152 + <b>Description:</b>
  153 + <i>
  154 + {{course.content}}
  155 + </i>
  156 + </p>
  157 + </div>
135 </div> 158 </div>
136 - </div>  
137 - </div>  
138 - {% endif %}  
139 - {% endfor %}  
140 - {% endif %}  
141 - {% else %}  
142 - No courses found  
143 - {% endif %}  
144 - <div class="group">  
145 - <div class="modal" id="removeCourse">  
146 - <div class="modal-dialog">  
147 - <div class="modal-content">  
148 - <div class="modal-header">  
149 - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button>  
150 - <h4 class="modal-title"></h4>  
151 - </div>  
152 - <div class="modal-body">  
153 - <p>Delete your course?</p>  
154 - </div>  
155 - <div class="modal-footer">  
156 -  
157 - <a href="http://127.0.0.1:8080/html/screens/users/profile_user.html" target="_self"><button type="button" class="btn btn-primary">Confirm</button></a>  
158 -  
159 - </div>  
160 - </div>  
161 - </div> 159 + {% endfor %}
  160 +
  161 + {% endblock %}
162 </div> 162 </div>
163 </div> 163 </div>
164 </div> 164 </div>
165 - <div class="col-md-12">  
166 - <nav aria-label="Page navigation">  
167 - <ul class="pagination">  
168 - {% if page_obj.has_previous %}  
169 - <li>  
170 - <a href="?page={{ page_obj.previous_page_number }}"><span><<</span></a>  
171 - </li>  
172 - {% endif %}  
173 - {% for page_number in paginator.page_range %}  
174 - <li{% if page_obj.number == page_number %} class="active"{% endif %}>  
175 - <a href="?page={{ page_number }}">{{ page_number }}</a>  
176 - </li>  
177 - {% endfor %}  
178 - {% if page_obj.has_next %}  
179 - <li>  
180 - <a href="?page={{ page_obj.next_page_number }}"><span>>></span></a>  
181 - </li>  
182 - {% endif %}  
183 - </ul>  
184 - </nav>  
185 - </div>  
186 -{% endcomment %} 165 + <script src="{% static 'js/main.js' %}"></script>
  166 + <script type="text/javascript" src="{% static 'js/topic_editation_presentation.js' %}"></script>
  167 + {% block script_file %}
  168 +
  169 + {% endblock script_file %}
  170 +</body>
  171 +
  172 +</html>
187 \ No newline at end of file 173 \ No newline at end of file
core/templates/index.html
@@ -11,18 +11,15 @@ @@ -11,18 +11,15 @@
11 11
12 {% block content %} 12 {% block content %}
13 <div class="row"> 13 <div class="row">
14 - <div class="col-sm-6 col-sm-offset-4 col-md-6 col-md-offset-4  
15 - col-xs-6 col-xs-offset-4 col-lg-6 col-lg-offset-4 col-xl-6 col-xl-offset-4 "> 14 + <div class="col-sm-6 col-sm-offset-4 col-md-6 col-md-offset-4 col-xs-6 col-xs-offset-4 col-lg-6 col-lg-offset-4 col-xl-6 col-xl-offset-4 ">
16 <div class="col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2 col-xs-8 col-xs-offset-2 col-lg-8 col-lg-offset-2 col-xl-8 col-xl-offset-2"> 15 <div class="col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2 col-xs-8 col-xs-offset-2 col-lg-8 col-lg-offset-2 col-xl-8 col-xl-offset-2">
17 -  
18 <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block logo-login " alt="logo amadeus"> 16 <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block logo-login " alt="logo amadeus">
19 -  
20 </div> 17 </div>
21 </div> 18 </div>
22 </div> 19 </div>
23 20
24 <div class="row"> 21 <div class="row">
25 - <div class="col-md-6 col-md-offset-4 col-sm-6 col-sm-offset-4 col-xs-6 col-xs-offset-4 col-lg-6 col-lg-offset-4 col-xl-6 col-xl-offset-4"> 22 + <div class="col-md-8 col-md-offset-3 col-sm-10 col-sm-offset-2 col-xs-12 col-xs-offset-1 col-lg-8 col-lg-offset-3 col-xl-8 col-xl-offset-3">
26 {% if messages %} 23 {% if messages %}
27 {% for message in messages %} 24 {% for message in messages %}
28 <div class="alert alert-{{ message.tags }} alert-dismissible" role="alert"> 25 <div class="alert alert-{{ message.tags }} alert-dismissible" role="alert">
@@ -37,13 +34,13 @@ @@ -37,13 +34,13 @@
37 <div class="card-block"> 34 <div class="card-block">
38 <form id="form-login" class="form-group" method="post" action=""> 35 <form id="form-login" class="form-group" method="post" action="">
39 {% csrf_token %} 36 {% csrf_token %}
40 - <div class="col-md-8 col-xs-8 col-lg-10 col-lg-offset-1 col-sm-10"> 37 + <div class="col-md-12 col-xs-12 col-lg-10 col-lg-offset-1 col-sm-12">
41 <div class="form-group"> 38 <div class="form-group">
42 <label for="inputEmail" class="control-label"> {% trans 'Username' %}</label> 39 <label for="inputEmail" class="control-label"> {% trans 'Username' %}</label>
43 <input form="form-login" for="inputSmall" type="text" name="username" class="form-control" placeholder="Username" id="inputEmail" value="{% if username %}{{username}}{% endif %}"> 40 <input form="form-login" for="inputSmall" type="text" name="username" class="form-control" placeholder="Username" id="inputEmail" value="{% if username %}{{username}}{% endif %}">
44 </div> 41 </div>
45 </div> 42 </div>
46 - <div class="col-md-8 col-xs-8 col-lg-10 col-lg-offset-1 col-sm-10"> 43 + <div class="col-md-12 col-xs-12 col-lg-10 col-lg-offset-1 col-sm-12">
47 <div class="form-group"> 44 <div class="form-group">
48 <label for="inputPassword" class="control-label"> {% trans 'Password' %}</label> 45 <label for="inputPassword" class="control-label"> {% trans 'Password' %}</label>
49 <input form="form-login" for="inputSmall" type="password" name="password" class="form-control" id="inputPassword" placeholder="Password"> 46 <input form="form-login" for="inputSmall" type="password" name="password" class="form-control" id="inputPassword" placeholder="Password">
core/templates/notifications.html
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <a href="{% url 'core:notification_read' notification.id %}"><div class="list-group-item"> 6 <a href="{% url 'core:notification_read' notification.id %}"><div class="list-group-item">
7 <div class="row-picture"> 7 <div class="row-picture">
8 <img class="circle" src="http://lorempixel.com/56/56/people/1" alt="icon"> 8 <img class="circle" src="http://lorempixel.com/56/56/people/1" alt="icon">
9 - <div class="least-content pull-right">{{ notification.datetime }}</div> 9 + <div class="least-content ">{{ notification.datetime }}</div>
10 </div> 10 </div>
11 <div class="row-content"> 11 <div class="row-content">
12 <p class="list-group-item-text">{{ notification.message }}</p> 12 <p class="list-group-item-text">{{ notification.message }}</p>
core/templates/register_user.html
@@ -19,81 +19,84 @@ @@ -19,81 +19,84 @@
19 {% endfor %} 19 {% endfor %}
20 {% endif %} 20 {% endif %}
21 <div class="row"> 21 <div class="row">
22 - <div class="col-lg-offset-2 col-lg-8 col-md-offset-2 col-md-8 col-xs-offset-2 col-xs-8 col-sm-offset-2 col-sm-8">  
23 - <div class="col-lg-8 col-md-8 col-xs-8 col-sm-8">  
24 - <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus" id="logo">  
25 - </div>  
26 - </div> 22 + <div class="col-sm-6 col-sm-offset-4 col-md-6 col-md-offset-4 col-xs-6 col-xs-offset-4 col-lg-6 col-lg-offset-4 col-xl-6 col-xl-offset-4 ">
  23 + <div class="col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2 col-xs-8 col-xs-offset-2 col-lg-8 col-lg-offset-2 col-xl-8 col-xl-offset-2">
  24 + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block logo-login " alt="logo amadeus">
  25 + </div>
  26 + </div>
27 </div> 27 </div>
28 28
29 <div class="row"> 29 <div class="row">
30 - <div class="col-lg-8 col-lg-offset-1 col-md-8 col-md-offset-1 col-sm-8 col-sm-offset-1 col-xs-8 col-xs-offset-1"> 30 + <div class="col-md-8 col-md-offset-3 col-sm-10 col-sm-offset-2 col-xs-12 col-xs-offset-1 col-lg-10 col-lg-offset-2 col-xl-8 col-xl-offset-3">
31 <div class="card"> 31 <div class="card">
32 <div class="card-content"> 32 <div class="card-content">
33 <div class="card-body"> 33 <div class="card-body">
34 - <form class="form-horizontal" name="registerForm" method="post" action="" enctype="multipart/form-data"> 34 + <form class="form-horizontal" name="registerForm" method="post" id="register-user" enctype="multipart/form-data">
35 {% csrf_token %} 35 {% csrf_token %}
36 - <legend>{% trans 'User Register' %}</legend>  
37 - {% for field in form %}  
38 - <div class="form-group is-empy{% if form.has_error %} has-error {% endif %} is-fileinput">  
39 - {% if field.field.required %}  
40 - <label for="{{ field.auto_id }}" class="col-md-4 control-label">{{ field.label }}<span>*</span></label>  
41 - {% else %}  
42 - <label for="{{ field.auto_id }}" class="col-md-4 control-label">{{ field.label }}</label>  
43 - {% endif %}  
44 - <div class="col-md-8">  
45 - {% if field.auto_id == 'id_birth_date' %}  
46 - {% render_field field class='form-control input-sm date-picker' %}  
47 -  
48 - <span id="helpBlock" class="help-block">{{ field.help_text }}</span>  
49 - {% elif field.auto_id == 'id_image' %}  
50 - {% render_field field class='form-control input-sm' %}  
51 - <div class="input-group">  
52 - <input type="text" readonly="" class="form-control" placeholder="Choose your photo...">  
53 - <span class="input-group-btn input-group-sm">  
54 - <button type="button" class="btn btn-fab btn-fab-mini">  
55 - <i class="material-icons">attach_file</i>  
56 - </button>  
57 - </span>  
58 - </div>  
59 - {% elif field.auto_id == 'id_cpf' %}  
60 - {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %} 36 + <h2>{% trans 'User Register' %}</h2>
  37 + <hr>
  38 + <div class="row">
  39 + <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
  40 + {% for field in form %}
  41 + <div class="form-group {% if form.has_error %} has-error {% endif %} is-fileinput block-register-inline">
  42 + {% if field.field.required %}
  43 + <label for="{{ field.auto_id }}" class="col-md-4 control-label">{{ field.label }}<span>*</span></label>
  44 + {% else %}
  45 + <label for="{{ field.auto_id }}" class="col-md-4 control-label">{{ field.label }}</label>
  46 + {% endif %}
  47 + <div class="col-md-8 col-lg-10 col-lg-offset-2">
  48 + {% if field.auto_id == 'id_birth_date' %}
  49 + {% render_field field class='form-control input-sm date-picker' %}
  50 + <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
  51 + {% elif field.auto_id == 'id_image' %}
  52 + {% render_field field class='form-control input-sm' %}
  53 + <div class="input-group">
  54 + <input type="text" readonly="" class="form-control" placeholder="Choose your photo...">
  55 + <span class="input-group-btn input-group-sm">
  56 + <button type="button" class="btn btn-fab btn-fab-mini">
  57 + <i class="material-icons">attach_file</i>
  58 + </button>
  59 + </span>
  60 + </div>
  61 + {% elif field.auto_id == 'id_cpf' %}
  62 + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %}
61 63
62 - {% elif field.auto_id == 'id_phone' %}  
63 - {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %}  
64 - {% else %}  
65 - {% render_field field class='form-control' %}  
66 - <span id="helpBlock" class="help-block">{{ field.help_text }}</span>  
67 - {% endif %}  
68 - </div>  
69 -  
70 - {% if field.errors %}  
71 - <div class="alert alert-danger alert-dismissible col-md-offset-4 col-md-8" role="alert">  
72 - <button type="button" class="close" data-dismiss="alert" aria-label="Close">  
73 - <span aria-hidden="true">&times;</span>  
74 - </button>  
75 - <ul>  
76 - {% for error in field.errors %}  
77 - <li>{{ error }}</li> 64 + {% elif field.auto_id == 'id_phone' %}
  65 + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %}
  66 + {% else %}
  67 + {% render_field field class='form-control' %}
  68 + <span id="helpBlock" class="help-block">{{ field.help_text }}</span>
  69 + {% endif %}
  70 + </div>
  71 +
  72 + {% if field.errors %}
  73 + <div class="alert alert-danger alert-dismissible col-md-offset-4 col-md-8" role="alert">
  74 + <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  75 + <span aria-hidden="true">&times;</span>
  76 + </button>
  77 + <ul>
  78 + {% for error in field.errors %}
  79 + <li>{{ error }}</li>
  80 + {% endfor %}
  81 + </ul>
  82 + </div>
  83 + {% endif %}
  84 + </div>
78 {% endfor %} 85 {% endfor %}
79 - </ul> 86 + <div class="col-md-6 col-xs-6 col-sm-6 col-lg-5 col-lg-offset-1 text-center">
  87 + <input type="submit" value="{% trans 'Save' %}" class="btn btn-success btn-raised" />
  88 + </div>
  89 + <div class="col-md-6 col-xs-6 col-sm-6 col-lg-5 text-center">
  90 + <a href="{% url 'core:home' %}" class="btn btn-default btn-raised" >{% trans 'Cancel' %}</a>
  91 + </div>
80 </div> 92 </div>
81 - {% endif %}  
82 - </div>  
83 - {% endfor %}  
84 - <div class="col-md-offset-4 col-md-2 col-sm-2 col-xs-2">  
85 - <input type="submit" value="{% trans 'Save' %}" class="btn btn-sm btn-success" />  
86 </div> 93 </div>
87 - <div class="col-md-offset-3 col-md-2 col-sm-2 col-xs-2">  
88 - <a href="{% url 'core:home' %}" class="btn btn-sm btn-success" >{% trans 'Cancel' %}</a>  
89 - </div>  
90 -  
91 </form> 94 </form>
92 </div> 95 </div>
93 </div> 96 </div>
94 </div> 97 </div>
95 </div> 98 </div>
96 </div> 99 </div>
97 - 100 +
98 <br clear="all" /> 101 <br clear="all" />
99 {% endblock %} 102 {% endblock %}
core/templates/registration/passwor_reset_done.html
1 {% extends "index.html" %} 1 {% extends "index.html" %}
2 {% load i18n static %} 2 {% load i18n static %}
  3 +{% block content%}
3 4
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> 5 +<div class="row">
  6 + <div class="col-sm-6 col-sm-offset-4 col-md-6 col-md-offset-4 col-xs-6 col-xs-offset-4 col-lg-6 col-lg-offset-4 col-xl-6 col-xl-offset-4 ">
  7 + <div class="col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2 col-xs-8 col-xs-offset-2 col-lg-8 col-lg-offset-2 col-xl-8 col-xl-offset-2">
  8 + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block logo-login " alt="logo amadeus">
15 </div> 9 </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>{% trans "We have sent instructions to set up your password, if an account exists with the email entered. You should receive them soon." %}</p>  
26 - <p>{% trans "If you do not receive an email, please make sure you entered the address you registered, and check the spam folder." %}</p>  
27 - </div>  
28 - </form> 10 + </div>
  11 +</div>
  12 +<div class="row">
  13 + <div class="col-md-8 col-md-offset-3 col-sm-10 col-sm-offset-2 col-xs-12 col-xs-offset-1 col-lg-8 col-lg-offset-3 col-xl-8 col-xl-offset-3">
  14 + {% if success %}
  15 + <div class="alert alert-success alert-dismissible" role="alert">
  16 + <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  17 + <span aria-hidden="true">&times;</span>
  18 + </button>
  19 + <ul>
  20 + <li>{{ success }}</li>
  21 + </ul>
  22 + </div>
  23 + {% elif danger %}
  24 + <div class="alert alert-danger alert-dismissible" role="alert">
  25 + <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  26 + <span aria-hidden="true">&times;</span>
  27 + </button>
  28 + <ul>
  29 + <li>{{ danger }}</li>
  30 + </ul>
  31 + </div>
  32 + {% endif %}
  33 + <div class="card">
  34 + <div class="card-block">
  35 + <form class="form-group " method="post" action="">
  36 + <div class="col-md-12 col-xs-12 col-lg-10 col-lg-offset-1 col-sm-12">
  37 + {% csrf_token %}
  38 + <div class="form-group is-empty">
  39 + <p>{% trans "We have sent instructions to set up your password, if an account exists with the email entered. You should receive them soon." %}</p>
  40 + <p>{% trans "If you do not receive an email, please make sure you entered the address you registered, and check the spam folder." %}</p>
  41 + </div>
  42 + <div class="form-group">
  43 + <a href="{% url 'core:home' %}" class="btn btn-default btn-raised" >{% trans 'Back' %}</a>
29 </div> 44 </div>
30 </div> 45 </div>
31 - </div> 46 + </form>
32 </div> 47 </div>
  48 + </div>
33 </div> 49 </div>
34 -  
35 -{% endblock %} 50 +</div>
  51 +{% endblock content %}
core/templates/registration/passwor_reset_form.html
@@ -2,57 +2,53 @@ @@ -2,57 +2,53 @@
2 {% load i18n static %} 2 {% load i18n static %}
3 {% block content%} 3 {% block content%}
4 4
5 - <div class="row">  
6 - <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">  
7 - <div class="row">  
8 - <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">  
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 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">  
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">&times;</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">&times;</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 col-xs-12 col-sm-12 col-lg-12 col-xl-12">  
40 - <form class="form-group " method="post" action="">  
41 - {% csrf_token %}  
42 - <div class="form-group is-empty">  
43 - <label for="inputEmail" class="ccontrol-label"> {% trans 'E-mail' %}</label>  
44 - <input name="email" type="email" class="form-control" id="inputEmail" placeholder="Email" {% if email %}value="{{form.email}}"{% endif %}>  
45 - </div>  
46 - <div class="col-lg-offset-4 col-lg-4 col-xs-offset-4 col-xs-4 col-sm-offset-4 col-sm-4 col-md-offset-4 col-md-4 col-xl-offset-4 col-xl-4">  
47 - <button type="submite" class="btn btn-raised btn-primary btn-block">{% trans 'Send' %}</button>  
48 -  
49 - </div>  
50 - </form>  
51 - </div>  
52 - </div>  
53 - </div> 5 +<div class="row">
  6 + <div class="col-sm-6 col-sm-offset-4 col-md-6 col-md-offset-4 col-xs-6 col-xs-offset-4 col-lg-6 col-lg-offset-4 col-xl-6 col-xl-offset-4 ">
  7 + <div class="col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2 col-xs-8 col-xs-offset-2 col-lg-8 col-lg-offset-2 col-xl-8 col-xl-offset-2">
  8 + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block logo-login " alt="logo amadeus">
  9 + </div>
  10 + </div>
  11 +</div>
  12 +<div class="row">
  13 + <div class="col-md-8 col-md-offset-3 col-sm-10 col-sm-offset-2 col-xs-12 col-xs-offset-1 col-lg-8 col-lg-offset-3 col-xl-8 col-xl-offset-3">
  14 + {% if success %}
  15 + <div class="alert alert-success alert-dismissible" role="alert">
  16 + <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  17 + <span aria-hidden="true">&times;</span>
  18 + </button>
  19 + <ul>
  20 + <li>{{ success }}</li>
  21 + </ul>
  22 + </div>
  23 + {% elif danger %}
  24 + <div class="alert alert-danger alert-dismissible" role="alert">
  25 + <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  26 + <span aria-hidden="true">&times;</span>
  27 + </button>
  28 + <ul>
  29 + <li>{{ danger }}</li>
  30 + </ul>
  31 + </div>
  32 + {% endif %}
  33 + <div class="card">
  34 + <div class="card-block">
  35 + <form class="form-group " method="post" action="">
  36 + <div class="col-md-12 col-xs-12 col-lg-10 col-lg-offset-1 col-sm-12">
  37 + {% csrf_token %}
  38 + <div class="form-group is-empty">
  39 + <label for="inputEmail" class="ccontrol-label"> {% trans 'E-mail' %}</label>
  40 + <input name="email" type="email" class="form-control" id="inputEmail" placeholder="Email" {% if email %}value="{{form.email}}"{% endif %}>
  41 + </div>
  42 + <div class="form-group send-reset-email">
  43 + <button type="submite" class="btn btn-raised btn-primary ">{% trans 'Send' %}</button>
  44 + </div>
  45 + <div class="form-group">
  46 + <a href="{% url 'core:home' %}" class="btn btn-default btn-raised" >{% trans 'Back' %}</a>
  47 + </div>
  48 + </div>
  49 + </form>
54 </div> 50 </div>
55 </div> 51 </div>
56 </div> 52 </div>
57 - 53 +</div>
58 {% endblock content %} 54 {% endblock content %}
@@ -68,7 +68,7 @@ def remember_password(request): @@ -68,7 +68,7 @@ def remember_password(request):
68 context['danger'] = 'E-mail does not send' 68 context['danger'] = 'E-mail does not send'
69 return render(request, "remember_password.html",context) 69 return render(request, "remember_password.html",context)
70 70
71 -@notification_decorator(message='just connected') 71 +@notification_decorator(message='just connected', not_action="logged in", not_resource="")
72 @log_decorator('Acessar', 'Sistema') 72 @log_decorator('Acessar', 'Sistema')
73 def login(request): 73 def login(request):
74 context = {} 74 context = {}
@@ -116,6 +116,7 @@ def getNotifications(request): @@ -116,6 +116,7 @@ def getNotifications(request):
116 116
117 def guest (request): 117 def guest (request):
118 context = { 118 context = {
119 - 'courses': Course.objects.filter(public=True) 119 + 'courses': Course.objects.filter(public=True),
  120 + 'categories': CourseCategory.objects.all(),
120 } 121 }
121 return render(request, 'guest.html', context) 122 return render(request, 'guest.html', context)
122 \ No newline at end of file 123 \ No newline at end of file
courses/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-10-18 21:42 2 +# Generated by Django 1.10 on 2016-10-22 04:32
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 import s3direct.fields 9 import s3direct.fields
@@ -14,6 +15,7 @@ class Migration(migrations.Migration): @@ -14,6 +15,7 @@ class Migration(migrations.Migration):
14 15
15 dependencies = [ 16 dependencies = [
16 ('core', '0001_initial'), 17 ('core', '0001_initial'),
  18 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
17 ] 19 ]
18 20
19 operations = [ 21 operations = [
@@ -23,6 +25,7 @@ class Migration(migrations.Migration): @@ -23,6 +25,7 @@ class Migration(migrations.Migration):
23 ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')), 25 ('resource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='core.Resource')),
24 ('limit_date', models.DateField(verbose_name='Deliver Date')), 26 ('limit_date', models.DateField(verbose_name='Deliver Date')),
25 ('all_students', models.BooleanField(default=False, verbose_name='All Students')), 27 ('all_students', models.BooleanField(default=False, verbose_name='All Students')),
  28 + ('students', models.ManyToManyField(related_name='activities', to=settings.AUTH_USER_MODEL, verbose_name='Students')),
26 ], 29 ],
27 bases=('core.resource',), 30 bases=('core.resource',),
28 ), 31 ),
@@ -32,10 +35,11 @@ class Migration(migrations.Migration): @@ -32,10 +35,11 @@ class Migration(migrations.Migration):
32 ('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')),
33 ('pdf', s3direct.fields.S3DirectField()), 36 ('pdf', s3direct.fields.S3DirectField()),
34 ('name', models.CharField(max_length=100)), 37 ('name', models.CharField(max_length=100)),
  38 + ('diet', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='courses.Activity')),
35 ], 39 ],
36 options={ 40 options={
37 - 'verbose_name': 'Activity File',  
38 'verbose_name_plural': 'Activitys Files', 41 'verbose_name_plural': 'Activitys Files',
  42 + 'verbose_name': 'Activity File',
39 }, 43 },
40 ), 44 ),
41 migrations.CreateModel( 45 migrations.CreateModel(
@@ -47,8 +51,8 @@ class Migration(migrations.Migration): @@ -47,8 +51,8 @@ class Migration(migrations.Migration):
47 ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), 51 ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')),
48 ], 52 ],
49 options={ 53 options={
50 - 'verbose_name': 'Category',  
51 'verbose_name_plural': 'Categories', 54 'verbose_name_plural': 'Categories',
  55 + 'verbose_name': 'Category',
52 }, 56 },
53 ), 57 ),
54 migrations.CreateModel( 58 migrations.CreateModel(
@@ -66,11 +70,12 @@ class Migration(migrations.Migration): @@ -66,11 +70,12 @@ class Migration(migrations.Migration):
66 ('init_date', models.DateField(verbose_name='Begin of Course Date')), 70 ('init_date', models.DateField(verbose_name='Begin of Course Date')),
67 ('end_date', models.DateField(verbose_name='End of Course Date')), 71 ('end_date', models.DateField(verbose_name='End of Course Date')),
68 ('image', models.ImageField(blank=True, upload_to='courses/', verbose_name='Image')), 72 ('image', models.ImageField(blank=True, upload_to='courses/', verbose_name='Image')),
  73 + ('public', models.BooleanField(verbose_name='Public')),
69 ], 74 ],
70 options={ 75 options={
71 - 'ordering': ('create_date', 'name'),  
72 - 'verbose_name': 'Course',  
73 'verbose_name_plural': 'Courses', 76 'verbose_name_plural': 'Courses',
  77 + 'verbose_name': 'Course',
  78 + 'ordering': ('create_date', 'name'),
74 }, 79 },
75 ), 80 ),
76 migrations.CreateModel( 81 migrations.CreateModel(
@@ -82,8 +87,8 @@ class Migration(migrations.Migration): @@ -82,8 +87,8 @@ class Migration(migrations.Migration):
82 ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), 87 ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')),
83 ], 88 ],
84 options={ 89 options={
85 - 'verbose_name': 'Category',  
86 'verbose_name_plural': 'Categories', 90 'verbose_name_plural': 'Categories',
  91 + 'verbose_name': 'Category',
87 }, 92 },
88 ), 93 ),
89 migrations.CreateModel( 94 migrations.CreateModel(
@@ -108,6 +113,7 @@ class Migration(migrations.Migration): @@ -108,6 +113,7 @@ class Migration(migrations.Migration):
108 fields=[ 113 fields=[
109 ('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')), 114 ('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')),
110 ('all_students', models.BooleanField(default=False, verbose_name='All Students')), 115 ('all_students', models.BooleanField(default=False, verbose_name='All Students')),
  116 + ('students', models.ManyToManyField(related_name='materials', to=settings.AUTH_USER_MODEL, verbose_name='Students')),
111 ], 117 ],
112 bases=('core.resource',), 118 bases=('core.resource',),
113 ), 119 ),
@@ -123,11 +129,15 @@ class Migration(migrations.Migration): @@ -123,11 +129,15 @@ class Migration(migrations.Migration):
123 ('end_date', models.DateField(verbose_name='End of Subject Date')), 129 ('end_date', models.DateField(verbose_name='End of Subject Date')),
124 ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), 130 ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')),
125 ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), 131 ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')),
  132 + ('category', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='subject_category', to='courses.CategorySubject', verbose_name='Category')),
  133 + ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course')),
  134 + ('professors', models.ManyToManyField(related_name='professors_subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors')),
  135 + ('students', models.ManyToManyField(blank=True, related_name='subject_student', to=settings.AUTH_USER_MODEL, verbose_name='Students')),
126 ], 136 ],
127 options={ 137 options={
128 - 'ordering': ('create_date', 'name'),  
129 - 'verbose_name': 'Subject',  
130 'verbose_name_plural': 'Subjects', 138 'verbose_name_plural': 'Subjects',
  139 + 'verbose_name': 'Subject',
  140 + 'ordering': ('create_date', 'name'),
131 }, 141 },
132 ), 142 ),
133 migrations.CreateModel( 143 migrations.CreateModel(
@@ -137,10 +147,11 @@ class Migration(migrations.Migration): @@ -137,10 +147,11 @@ class Migration(migrations.Migration):
137 ('name', models.CharField(max_length=100, verbose_name='Name')), 147 ('name', models.CharField(max_length=100, verbose_name='Name')),
138 ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), 148 ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')),
139 ('description', models.TextField(blank=True, verbose_name='Description')), 149 ('description', models.TextField(blank=True, verbose_name='Description')),
  150 + ('subjects', models.ManyToManyField(to='courses.Subject')),
140 ], 151 ],
141 options={ 152 options={
142 - 'verbose_name': 'subject category',  
143 'verbose_name_plural': 'subject categories', 153 'verbose_name_plural': 'subject categories',
  154 + 'verbose_name': 'subject category',
144 }, 155 },
145 ), 156 ),
146 migrations.CreateModel( 157 migrations.CreateModel(
@@ -153,11 +164,48 @@ class Migration(migrations.Migration): @@ -153,11 +164,48 @@ class Migration(migrations.Migration):
153 ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), 164 ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')),
154 ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), 165 ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')),
155 ('visible', models.BooleanField(default=False, verbose_name='Visible')), 166 ('visible', models.BooleanField(default=False, verbose_name='Visible')),
  167 + ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Owner')),
  168 + ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject')),
156 ], 169 ],
157 options={ 170 options={
158 - 'ordering': ('create_date', 'name'),  
159 - 'verbose_name': 'Topic',  
160 'verbose_name_plural': 'Topics', 171 'verbose_name_plural': 'Topics',
  172 + 'verbose_name': 'Topic',
  173 + 'ordering': ('create_date', 'name'),
161 }, 174 },
162 ), 175 ),
  176 + migrations.AddField(
  177 + model_name='material',
  178 + name='topic',
  179 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'),
  180 + ),
  181 + migrations.AddField(
  182 + model_name='linkmaterial',
  183 + name='material',
  184 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_link', to='courses.Material', verbose_name='Material'),
  185 + ),
  186 + migrations.AddField(
  187 + model_name='filematerial',
  188 + name='material',
  189 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_file', to='courses.Material', verbose_name='Material'),
  190 + ),
  191 + migrations.AddField(
  192 + model_name='course',
  193 + name='category',
  194 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_category', to='courses.CourseCategory', verbose_name='Category'),
  195 + ),
  196 + migrations.AddField(
  197 + model_name='course',
  198 + name='professors',
  199 + field=models.ManyToManyField(related_name='courses_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors'),
  200 + ),
  201 + migrations.AddField(
  202 + model_name='course',
  203 + name='students',
  204 + field=models.ManyToManyField(blank=True, related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'),
  205 + ),
  206 + migrations.AddField(
  207 + model_name='activity',
  208 + name='topic',
  209 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'),
  210 + ),
163 ] 211 ]
courses/migrations/0002_auto_20161018_1842.py
@@ -1,105 +0,0 @@ @@ -1,105 +0,0 @@
1 -# -*- coding: utf-8 -*-  
2 -# Generated by Django 1.10 on 2016-10-18 21:42  
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='category',  
38 - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='subject_category', to='courses.CategorySubject', verbose_name='Category'),  
39 - ),  
40 - migrations.AddField(  
41 - model_name='subject',  
42 - name='course',  
43 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course'),  
44 - ),  
45 - migrations.AddField(  
46 - model_name='subject',  
47 - name='professors',  
48 - field=models.ManyToManyField(related_name='professors_subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors'),  
49 - ),  
50 - migrations.AddField(  
51 - model_name='subject',  
52 - name='students',  
53 - field=models.ManyToManyField(related_name='subject_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'),  
54 - ),  
55 - migrations.AddField(  
56 - model_name='material',  
57 - name='students',  
58 - field=models.ManyToManyField(related_name='materials', to=settings.AUTH_USER_MODEL, verbose_name='Students'),  
59 - ),  
60 - migrations.AddField(  
61 - model_name='material',  
62 - name='topic',  
63 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'),  
64 - ),  
65 - migrations.AddField(  
66 - model_name='linkmaterial',  
67 - name='material',  
68 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_link', to='courses.Material', verbose_name='Material'),  
69 - ),  
70 - migrations.AddField(  
71 - model_name='filematerial',  
72 - name='material',  
73 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_file', to='courses.Material', verbose_name='Material'),  
74 - ),  
75 - migrations.AddField(  
76 - model_name='course',  
77 - name='category',  
78 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_category', to='courses.CourseCategory', verbose_name='Category'),  
79 - ),  
80 - migrations.AddField(  
81 - model_name='course',  
82 - name='professors',  
83 - field=models.ManyToManyField(related_name='courses_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors'),  
84 - ),  
85 - migrations.AddField(  
86 - model_name='course',  
87 - name='students',  
88 - field=models.ManyToManyField(related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'),  
89 - ),  
90 - migrations.AddField(  
91 - model_name='activityfile',  
92 - name='diet',  
93 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='courses.Activity'),  
94 - ),  
95 - migrations.AddField(  
96 - model_name='activity',  
97 - name='students',  
98 - field=models.ManyToManyField(related_name='activities', to=settings.AUTH_USER_MODEL, verbose_name='Students'),  
99 - ),  
100 - migrations.AddField(  
101 - model_name='activity',  
102 - name='topic',  
103 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'),  
104 - ),  
105 - ]  
courses/migrations/0003_course_public.py
@@ -1,21 +0,0 @@ @@ -1,21 +0,0 @@
1 -# -*- coding: utf-8 -*-  
2 -# Generated by Django 1.10 on 2016-10-19 13:19  
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_20161018_1842'),  
12 - ]  
13 -  
14 - operations = [  
15 - migrations.AddField(  
16 - model_name='course',  
17 - name='public',  
18 - field=models.BooleanField(default=False, verbose_name='Public'),  
19 - preserve_default=False,  
20 - ),  
21 - ]  
courses/migrations/0004_auto_20161020_1808.py
@@ -1,21 +0,0 @@ @@ -1,21 +0,0 @@
1 -# -*- coding: utf-8 -*-  
2 -# Generated by Django 1.10 on 2016-10-20 21:08  
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 - ('courses', '0003_course_public'),  
13 - ]  
14 -  
15 - operations = [  
16 - migrations.AlterField(  
17 - model_name='course',  
18 - name='students',  
19 - field=models.ManyToManyField(blank=True, related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'),  
20 - ),  
21 - ]  
courses/models.py
@@ -6,6 +6,9 @@ from users.models import User @@ -6,6 +6,9 @@ from users.models import User
6 from core.models import Resource, MimeType 6 from core.models import Resource, MimeType
7 from s3direct.fields import S3DirectField 7 from s3direct.fields import S3DirectField
8 8
  9 +from django.core.urlresolvers import reverse
  10 +from core.models import Resource
  11 +
9 class CourseCategory(models.Model): 12 class CourseCategory(models.Model):
10 13
11 name = models.CharField(_('Name'), max_length = 100, unique = True) 14 name = models.CharField(_('Name'), max_length = 100, unique = True)
@@ -57,6 +60,9 @@ class Course(models.Model): @@ -57,6 +60,9 @@ class Course(models.Model):
57 def __str__(self): 60 def __str__(self):
58 return self.name 61 return self.name
59 62
  63 + def get_absolute_url (self):
  64 + return reverse('course:view', kwargs={'slug': self.slug})
  65 +
60 def show_subscribe(self): 66 def show_subscribe(self):
61 today = datetime.date.today() 67 today = datetime.date.today()
62 68
courses/static/js/course.js
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 * Function to subscribe (works for courses and subjects) 3 * Function to subscribe (works for courses and subjects)
4 * 4 *
5 */ 5 */
6 -function subscribe(elem, url, confirm_message) { 6 +function subscribe(elem, url, id, confirm_message) {
7 alertify.confirm(confirm_message, function(){ 7 alertify.confirm(confirm_message, function(){
8 $.ajax({ 8 $.ajax({
9 dataType: "json", 9 dataType: "json",
@@ -12,6 +12,7 @@ function subscribe(elem, url, confirm_message) { @@ -12,6 +12,7 @@ function subscribe(elem, url, confirm_message) {
12 if (data.status == "ok") { 12 if (data.status == "ok") {
13 elem.remove(); 13 elem.remove();
14 alertify.success(data.message); 14 alertify.success(data.message);
  15 + $(".panel_"+id).find(".view_btn").show()
15 } else { 16 } else {
16 alertify.error(data.message); 17 alertify.error(data.message);
17 } 18 }
courses/templates/course/index.html
@@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
21 <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> 21 <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>
22 {% if user|has_role:'student' or not user.is_staff %} 22 {% if user|has_role:'student' or not user.is_staff %}
23 <li><a href="{% url 'course:manage' %}">{% trans 'My courses' %}</a></li> 23 <li><a href="{% url 'course:manage' %}">{% trans 'My courses' %}</a></li>
  24 + <li><a href="{% url 'core:guest' %}">{% trans 'All Courses' %}</a></li>
24 {% endif %} 25 {% endif %}
25 {% if user|has_role:'system_admin' %} 26 {% if user|has_role:'system_admin' %}
26 <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li> 27 <li> <a href="{% url 'users:manage' %}">{% trans 'Manage Users' %}</a></li>
@@ -67,14 +68,7 @@ @@ -67,14 +68,7 @@
67 </div> 68 </div>
68 </form> 69 </form>
69 </div> 70 </div>
70 - <div class="col-md-12">  
71 - <div class="btn-group btn-group-justified btn-group-raised">  
72 - <a href="?category=all" class="btn btn-raised btn-info">Todos</a>  
73 - {% for category_course in categorys_courses %}  
74 - <a href="?category={{category_course.name}}" class="btn btn-raised btn-primary">{{category_course.name}}</a>  
75 - {% endfor %}  
76 - </div>  
77 - </div> 71 +
78 72
79 </fieldset> 73 </fieldset>
80 <div class="col-md-12"> 74 <div class="col-md-12">
courses/templates/course/view.html
@@ -28,6 +28,7 @@ @@ -28,6 +28,7 @@
28 <li><a href="{% url 'core:home' %}">{% trans "Home" %}</a></li> 28 <li><a href="{% url 'core:home' %}">{% trans "Home" %}</a></li>
29 <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li> 29 <li><a href="{% url 'users:profile' %}">{% trans 'Profile' %}</a></li>
30 <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li> 30 <li><a href="{% url 'course:manage' %}">{% trans 'My Courses' %}</a></li>
  31 + <li><a href="{% url 'core:guest' %}">{% trans 'All Courses' %}</a></li>
31 </ul> 32 </ul>
32 </div> 33 </div>
33 </div> 34 </div>
@@ -91,7 +92,7 @@ @@ -91,7 +92,7 @@
91 </div> 92 </div>
92 </div> 93 </div>
93 <div class="btn-group btn-group-justified btn-group-raised"> 94 <div class="btn-group btn-group-justified btn-group-raised">
94 - <a href="?category=all" class="btn btn-raised btn-info">Todos</a> 95 + <a href="{% url 'course:manage' %}" class="btn btn-raised btn-info">Todos</a>
95 {% for category_subject in categorys_subjects %} 96 {% for category_subject in categorys_subjects %}
96 <a href="?category={{category_subject.name}}" class="btn btn-raised btn-primary">{{category_subject.name}}</a> 97 <a href="?category={{category_subject.name}}" class="btn btn-raised btn-primary">{{category_subject.name}}</a>
97 {% endfor %} 98 {% endfor %}
@@ -195,7 +196,7 @@ @@ -195,7 +196,7 @@
195 <div> 196 <div>
196 {% if request.GET.category == 'all' or none or request.GET.category == '' %} 197 {% if request.GET.category == 'all' or none or request.GET.category == '' %}
197 {% for subject in subjects %} 198 {% for subject in subjects %}
198 - <div class="panel panel-info"> 199 + <div class="panel panel-info panel_{{ subject.id }}">
199 <div class="panel-heading headingTwo ui-sortable-handle" role="tab"> 200 <div class="panel-heading headingTwo ui-sortable-handle" role="tab">
200 <div class="row"> 201 <div class="row">
201 <div class="col-xs-9 col-md-10 titleTopic"> 202 <div class="col-xs-9 col-md-10 titleTopic">
@@ -219,7 +220,7 @@ @@ -219,7 +220,7 @@
219 220
220 {% if user|show_subject_subscribe:subject %} 221 {% if user|show_subject_subscribe:subject %}
221 <div class="col-xs-3 col-md-2"> 222 <div class="col-xs-3 col-md-2">
222 - <a onclick="subscribe($(this), '{% url 'course:subscribe_subject' subject.slug %}' , '{% trans 'Are you sure you want to subscribe to this subject?' %}')" class="btn btn-sm btn-primary btn-raised">{% trans 'Subscribe' %}</a> 223 + <a onclick="subscribe($(this), '{% url 'course:subscribe_subject' subject.slug %}', {{ subject.id }}, '{% trans 'Are you sure you want to subscribe to this subject?' %}')" class="btn btn-sm btn-primary btn-raised">{% trans 'Subscribe' %}</a>
223 </div> 224 </div>
224 {% endif %} 225 {% endif %}
225 </div> 226 </div>
@@ -241,14 +242,14 @@ @@ -241,14 +242,14 @@
241 <p><b>{% trans "End" %}: </b>{{subject.end_date}}</p> 242 <p><b>{% trans "End" %}: </b>{{subject.end_date}}</p>
242 </div> 243 </div>
243 </div> 244 </div>
244 - <a href="{% url 'course:view_subject' subject.slug %}" class="btn btn-raised btn-default center-block">{% trans 'View Subject' %}<div class="ripple-container"></div></a> 245 + <a href="{% url 'course:view_subject' subject.slug %}" class="btn btn-raised btn-default center-block view_btn" {% if user|show_subject_subscribe:subject %}style="display:none"{% endif %}>{% trans 'View Subject' %}<div class="ripple-container"></div></a>
245 </div> 246 </div>
246 </div> 247 </div>
247 {% endfor %} 248 {% endfor %}
248 {% else %} 249 {% else %}
249 {% for subject in subjects_category %} 250 {% for subject in subjects_category %}
250 {% if subject.category.name == request.GET.category %} 251 {% if subject.category.name == request.GET.category %}
251 - <div class="panel panel-info"> 252 + <div class="panel panel-info panel_{{ subject.id }}">
252 <div class="panel-heading headingTwo ui-sortable-handle" role="tab"> 253 <div class="panel-heading headingTwo ui-sortable-handle" role="tab">
253 <div class="row"> 254 <div class="row">
254 <div class="col-xs-9 col-md-10 titleTopic"> 255 <div class="col-xs-9 col-md-10 titleTopic">
@@ -271,7 +272,7 @@ @@ -271,7 +272,7 @@
271 {% endif %} 272 {% endif %}
272 {% if user|show_subject_subscribe:subject %} 273 {% if user|show_subject_subscribe:subject %}
273 <div class="col-xs-3 col-md-2"> 274 <div class="col-xs-3 col-md-2">
274 - <a onclick="subscribe($(this), '{% url 'course:subscribe_subject' subject.slug %}' , '{% trans 'Are you sure you want to subscribe to this subject?' %}')" class="btn btn-sm btn-primary btn-raised">{% trans 'Subscribe' %}</a> 275 + <a onclick="subscribe($(this), '{% url 'course:subscribe_subject' subject.slug %}', {{ subject.id }}, '{% trans 'Are you sure you want to subscribe to this subject?' %}')" class="btn btn-sm btn-primary btn-raised">{% trans 'Subscribe' %}</a>
275 </div> 276 </div>
276 {% endif %} 277 {% endif %}
277 </div> 278 </div>
@@ -293,14 +294,14 @@ @@ -293,14 +294,14 @@
293 <p><b>{% trans "End" %}: </b>{{subject.end_date}}</p> 294 <p><b>{% trans "End" %}: </b>{{subject.end_date}}</p>
294 </div> 295 </div>
295 </div> 296 </div>
296 - <a href="{% url 'course:view_subject' subject.slug %}" class="btn btn-raised btn-default center-block">{% trans 'View Subject' %}<div class="ripple-container"></div></a> 297 + <a href="{% url 'course:view_subject' subject.slug %}" class="btn btn-raised btn-default center-block view_btn" {% if user|show_subject_subscribe:subject %}style="display:none"{% endif %}>{% trans 'View Subject' %}<div class="ripple-container"></div></a>
297 </div> 298 </div>
298 </div> 299 </div>
299 {% endif %} 300 {% endif %}
300 {% endfor %} 301 {% endfor %}
301 {% endif %} 302 {% endif %}
302 303
303 -{% if user|has_role:'professor' and user in course.professors or user|has_role:'system_admin' %} 304 +{% if user|has_role:'professor' and user in course.professors.all or user|has_role:'system_admin' %}
304 305
305 <div class="form-group"> 306 <div class="form-group">
306 <a href="{% url 'course:create_subject' course.slug %}" data-toggle="modal" data-target="" class="btn btn-primary btn-lg btn-block btn-raised">{% trans 'Create Subject' %}<div class="ripple-container"></div></a> 307 <a href="{% url 'course:create_subject' course.slug %}" data-toggle="modal" data-target="" class="btn btn-primary btn-lg btn-block btn-raised">{% trans 'Create Subject' %}<div class="ripple-container"></div></a>
courses/templates/subject/form_view_teacher.html
@@ -178,7 +178,7 @@ @@ -178,7 +178,7 @@
178 </div> 178 </div>
179 <div class="modal-footer"> 179 <div class="modal-footer">
180 180
181 - <a href="http://localhost:8080/html/screens/users/profile_user.html" target="_self"><button type="button" class="btn btn-primary">Confirm</button></a> 181 + <a href="" target="_self"><button type="button" class="btn btn-primary">Confirm</button></a>
182 182
183 </div> 183 </div>
184 </div> 184 </div>
courses/views.py
@@ -429,7 +429,11 @@ class CreateTopicView(LoginRequiredMixin, HasRoleMixin, NotificationMixin, gener @@ -429,7 +429,11 @@ class CreateTopicView(LoginRequiredMixin, HasRoleMixin, NotificationMixin, gener
429 self.object.subject = subject 429 self.object.subject = subject
430 self.object.owner = self.request.user 430 self.object.owner = self.request.user
431 self.object.save() 431 self.object.save()
432 - 432 + action = super(CreateTopicView, self).createorRetrieveAction("create Topic")
  433 + super(CreateTopicView, self).createNotification("Topic "+ self.object.name + " was created",
  434 + resource_name=self.object.name, resource_link= 'topics/'+self.object.slug,
  435 + actor=self.request.user, users = self.object.subject.course.students.all() )
  436 +
433 return super(CreateTopicView, self).form_valid(form) 437 return super(CreateTopicView, self).form_valid(form)
434 438
435 class UpdateTopicView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView): 439 class UpdateTopicView(LoginRequiredMixin, HasRoleMixin, generic.UpdateView):
exam/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-10-18 21:42 2 +# Generated by Django 1.10 on 2016-10-22 04:32
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,6 +12,7 @@ class Migration(migrations.Migration): @@ -11,6 +12,7 @@ class Migration(migrations.Migration):
11 initial = True 12 initial = True
12 13
13 dependencies = [ 14 dependencies = [
  15 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14 ('courses', '0001_initial'), 16 ('courses', '0001_initial'),
15 ] 17 ]
16 18
@@ -23,9 +25,22 @@ class Migration(migrations.Migration): @@ -23,9 +25,22 @@ class Migration(migrations.Migration):
23 ('order', models.PositiveSmallIntegerField(verbose_name='Order')), 25 ('order', models.PositiveSmallIntegerField(verbose_name='Order')),
24 ], 26 ],
25 options={ 27 options={
26 - 'ordering': ('order',),  
27 - 'verbose_name': 'Answer',  
28 'verbose_name_plural': 'Answers', 28 'verbose_name_plural': 'Answers',
  29 + 'verbose_name': 'Answer',
  30 + 'ordering': ('order',),
  31 + },
  32 + ),
  33 + migrations.CreateModel(
  34 + name='AnswersStudent',
  35 + fields=[
  36 + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  37 + ('status', models.BooleanField(default=False, verbose_name='Answered')),
  38 + ('answered_in', models.DateTimeField(auto_now=True, verbose_name='Answered Date')),
  39 + ('answer', models.ManyToManyField(related_name='student_answer', to='exam.Answer', verbose_name='Answers Students')),
  40 + ],
  41 + options={
  42 + 'verbose_name_plural': 'Answers Student',
  43 + 'verbose_name': 'Answer Stundent',
29 }, 44 },
30 ), 45 ),
31 migrations.CreateModel( 46 migrations.CreateModel(
@@ -35,12 +50,22 @@ class Migration(migrations.Migration): @@ -35,12 +50,22 @@ class Migration(migrations.Migration):
35 ('begin_date', models.DateField(blank=True, verbose_name='Begin of Course Date')), 50 ('begin_date', models.DateField(blank=True, verbose_name='Begin of Course Date')),
36 ], 51 ],
37 options={ 52 options={
38 - 'verbose_name': 'Exam',  
39 'verbose_name_plural': 'Exams', 53 'verbose_name_plural': 'Exams',
  54 + 'verbose_name': 'Exam',
40 }, 55 },
41 bases=('courses.activity',), 56 bases=('courses.activity',),
42 ), 57 ),
43 migrations.AddField( 58 migrations.AddField(
  59 + model_name='answersstudent',
  60 + name='exam',
  61 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student_exam', to='exam.Exam', verbose_name='Exam'),
  62 + ),
  63 + migrations.AddField(
  64 + model_name='answersstudent',
  65 + name='student',
  66 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student', to=settings.AUTH_USER_MODEL, verbose_name='Student'),
  67 + ),
  68 + migrations.AddField(
44 model_name='answer', 69 model_name='answer',
45 name='exam', 70 name='exam',
46 field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='exam.Exam', verbose_name='Answers'), 71 field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='exam.Exam', verbose_name='Answers'),
exam/migrations/0002_answersstudent.py
@@ -1,33 +0,0 @@ @@ -1,33 +0,0 @@
1 -# -*- coding: utf-8 -*-  
2 -# Generated by Django 1.10 on 2016-10-20 21: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 - ('exam', '0001_initial'),  
15 - ]  
16 -  
17 - operations = [  
18 - migrations.CreateModel(  
19 - name='AnswersStudent',  
20 - fields=[  
21 - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),  
22 - ('status', models.BooleanField(default=False, verbose_name='Answered')),  
23 - ('answered_in', models.DateTimeField(auto_now=True, verbose_name='Answered Date')),  
24 - ('answer', models.ManyToManyField(related_name='student_answer', to='exam.Answer', verbose_name='Answers Students')),  
25 - ('exam', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student_exam', to='exam.Exam', verbose_name='Exam')),  
26 - ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student', to=settings.AUTH_USER_MODEL, verbose_name='Student')),  
27 - ],  
28 - options={  
29 - 'verbose_name': 'Answer Stundent',  
30 - 'verbose_name_plural': 'Answers Student',  
31 - },  
32 - ),  
33 - ]  
files/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-10-18 21:42 2 +# Generated by Django 1.10 on 2016-10-22 04:32
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 import files.models 8 import files.models
@@ -14,6 +15,7 @@ class Migration(migrations.Migration): @@ -14,6 +15,7 @@ class Migration(migrations.Migration):
14 dependencies = [ 15 dependencies = [
15 ('courses', '0001_initial'), 16 ('courses', '0001_initial'),
16 ('core', '0001_initial'), 17 ('core', '0001_initial'),
  18 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
17 ] 19 ]
18 20
19 operations = [ 21 operations = [
@@ -24,10 +26,11 @@ class Migration(migrations.Migration): @@ -24,10 +26,11 @@ class Migration(migrations.Migration):
24 ('description', models.TextField(blank=True, verbose_name='Description')), 26 ('description', models.TextField(blank=True, verbose_name='Description')),
25 ('file_url', models.FileField(upload_to=files.models.file_path, verbose_name='File')), 27 ('file_url', models.FileField(upload_to=files.models.file_path, verbose_name='File')),
26 ('file_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topic_files', to='core.MimeType', verbose_name='Type file')), 28 ('file_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topic_files', to='core.MimeType', verbose_name='Type file')),
  29 + ('professor', models.ManyToManyField(related_name='file_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors')),
27 ], 30 ],
28 options={ 31 options={
29 - 'ordering': ('-id',),  
30 'verbose_name': 'File', 32 'verbose_name': 'File',
  33 + 'ordering': ('-id',),
31 'verbose_name_plural': 'Files', 34 'verbose_name_plural': 'Files',
32 }, 35 },
33 bases=('courses.material',), 36 bases=('courses.material',),
files/migrations/0002_topicfile_professor.py
@@ -1,24 +0,0 @@ @@ -1,24 +0,0 @@
1 -# -*- coding: utf-8 -*-  
2 -# Generated by Django 1.10 on 2016-10-18 21:42  
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 - initial = True  
12 -  
13 - dependencies = [  
14 - migrations.swappable_dependency(settings.AUTH_USER_MODEL),  
15 - ('files', '0001_initial'),  
16 - ]  
17 -  
18 - operations = [  
19 - migrations.AddField(  
20 - model_name='topicfile',  
21 - name='professor',  
22 - field=models.ManyToManyField(related_name='file_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors'),  
23 - ),  
24 - ]  
forum/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-10-18 21:42 2 +# Generated by Django 1.10 on 2016-10-22 04:32
3 from __future__ import unicode_literals 3 from __future__ import unicode_literals
4 4
  5 +from django.conf import settings
5 from django.db import migrations, models 6 from django.db import migrations, models
6 import django.db.models.deletion 7 import django.db.models.deletion
7 8
@@ -12,6 +13,7 @@ class Migration(migrations.Migration): @@ -12,6 +13,7 @@ class Migration(migrations.Migration):
12 13
13 dependencies = [ 14 dependencies = [
14 ('courses', '0001_initial'), 15 ('courses', '0001_initial'),
  16 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
15 ] 17 ]
16 18
17 operations = [ 19 operations = [
@@ -24,8 +26,8 @@ class Migration(migrations.Migration): @@ -24,8 +26,8 @@ class Migration(migrations.Migration):
24 ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Create Date')), 26 ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Create Date')),
25 ], 27 ],
26 options={ 28 options={
27 - 'verbose_name': 'Forum',  
28 'verbose_name_plural': 'Foruns', 29 'verbose_name_plural': 'Foruns',
  30 + 'verbose_name': 'Forum',
29 }, 31 },
30 bases=('courses.activity',), 32 bases=('courses.activity',),
31 ), 33 ),
@@ -36,10 +38,12 @@ class Migration(migrations.Migration): @@ -36,10 +38,12 @@ class Migration(migrations.Migration):
36 ('message', models.TextField(verbose_name='Post message')), 38 ('message', models.TextField(verbose_name='Post message')),
37 ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), 39 ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')),
38 ('post_date', models.DateTimeField(auto_now_add=True, verbose_name='Post Date')), 40 ('post_date', models.DateTimeField(auto_now_add=True, verbose_name='Post Date')),
  41 + ('forum', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Forum', verbose_name='Forum')),
  42 + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor')),
39 ], 43 ],
40 options={ 44 options={
41 - 'verbose_name': 'Post',  
42 'verbose_name_plural': 'Posts', 45 'verbose_name_plural': 'Posts',
  46 + 'verbose_name': 'Post',
43 }, 47 },
44 ), 48 ),
45 migrations.CreateModel( 49 migrations.CreateModel(
@@ -50,10 +54,11 @@ class Migration(migrations.Migration): @@ -50,10 +54,11 @@ class Migration(migrations.Migration):
50 ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')), 54 ('modification_date', models.DateTimeField(auto_now=True, verbose_name='Modification Date')),
51 ('answer_date', models.DateTimeField(auto_now_add=True, verbose_name='Answer Date')), 55 ('answer_date', models.DateTimeField(auto_now_add=True, verbose_name='Answer Date')),
52 ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Post', verbose_name='Post')), 56 ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Post', verbose_name='Post')),
  57 + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor')),
53 ], 58 ],
54 options={ 59 options={
55 - 'verbose_name': 'Post Answer',  
56 'verbose_name_plural': 'Post Answers', 60 'verbose_name_plural': 'Post Answers',
  61 + 'verbose_name': 'Post Answer',
57 }, 62 },
58 ), 63 ),
59 ] 64 ]
forum/migrations/0002_auto_20161018_1842.py
@@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
1 -# -*- coding: utf-8 -*-  
2 -# Generated by Django 1.10 on 2016-10-18 21:42  
3 -from __future__ import unicode_literals  
4 -  
5 -from django.conf import settings  
6 -from django.db import migrations, models  
7 -import django.db.models.deletion  
8 -  
9 -  
10 -class Migration(migrations.Migration):  
11 -  
12 - initial = True  
13 -  
14 - dependencies = [  
15 - migrations.swappable_dependency(settings.AUTH_USER_MODEL),  
16 - ('forum', '0001_initial'),  
17 - ]  
18 -  
19 - operations = [  
20 - migrations.AddField(  
21 - model_name='postanswer',  
22 - name='user',  
23 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor'),  
24 - ),  
25 - migrations.AddField(  
26 - model_name='post',  
27 - name='forum',  
28 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Forum', verbose_name='Forum'),  
29 - ),  
30 - migrations.AddField(  
31 - model_name='post',  
32 - name='user',  
33 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor'),  
34 - ),  
35 - ]  
forum/views.py
@@ -9,6 +9,8 @@ from django.http import Http404 @@ -9,6 +9,8 @@ from django.http import Http404
9 9
10 from .models import Forum, Post, PostAnswer 10 from .models import Forum, Post, PostAnswer
11 from courses.models import Topic 11 from courses.models import Topic
  12 +from core.mixins import NotificationMixin
  13 +from core.models import Action, Resource
12 14
13 from .forms import ForumForm, PostForm, PostAnswerForm 15 from .forms import ForumForm, PostForm, PostAnswerForm
14 16
@@ -36,7 +38,7 @@ class ForumIndex(LoginRequiredMixin, generic.ListView): @@ -36,7 +38,7 @@ class ForumIndex(LoginRequiredMixin, generic.ListView):
36 38
37 return context 39 return context
38 40
39 -class CreateForumView(LoginRequiredMixin, generic.edit.CreateView): 41 +class CreateForumView(LoginRequiredMixin, generic.edit.CreateView, NotificationMixin):
40 login_url = reverse_lazy("core:home") 42 login_url = reverse_lazy("core:home")
41 redirect_field_name = 'next' 43 redirect_field_name = 'next'
42 44
@@ -52,6 +54,11 @@ class CreateForumView(LoginRequiredMixin, generic.edit.CreateView): @@ -52,6 +54,11 @@ class CreateForumView(LoginRequiredMixin, generic.edit.CreateView):
52 def get_success_url(self): 54 def get_success_url(self):
53 self.success_url = reverse('course:forum:render_forum', args = (self.object.id, )) 55 self.success_url = reverse('course:forum:render_forum', args = (self.object.id, ))
54 56
  57 +
  58 + action = super(CreateForumView, self).createorRetrieveAction("create Topic")
  59 + super(CreateForumView, self).createNotification("Forum "+ self.object.name + " was created",
  60 + resource_name=self.object.name, resource_link= 'topics/'+self.object.slug,
  61 + actor=self.request.user, users = self.object.topic.subject.course.students.all() )
55 return self.success_url 62 return self.success_url
56 63
57 def render_forum(request, forum): 64 def render_forum(request, forum):
links/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-10-18 21:42 2 +# Generated by Django 1.10 on 2016-10-22 04:32
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
@@ -23,8 +23,8 @@ class Migration(migrations.Migration): @@ -23,8 +23,8 @@ class Migration(migrations.Migration):
23 ('link_description', models.CharField(max_length=200)), 23 ('link_description', models.CharField(max_length=200)),
24 ], 24 ],
25 options={ 25 options={
26 - 'verbose_name': 'Link',  
27 'verbose_name_plural': 'Links', 26 'verbose_name_plural': 'Links',
  27 + 'verbose_name': 'Link',
28 }, 28 },
29 bases=('courses.material',), 29 bases=('courses.material',),
30 ), 30 ),
poll/migrations/0001_initial.py
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 -# Generated by Django 1.10 on 2016-10-18 21:42 2 +# Generated by Django 1.10 on 2016-10-22 04:32
3 from __future__ import unicode_literals 3 from __future__ import unicode_literals
4 4
  5 +from django.conf import settings
5 from django.db import migrations, models 6 from django.db import migrations, models
6 import django.db.models.deletion 7 import django.db.models.deletion
7 8
@@ -12,6 +13,7 @@ class Migration(migrations.Migration): @@ -12,6 +13,7 @@ class Migration(migrations.Migration):
12 13
13 dependencies = [ 14 dependencies = [
14 ('courses', '0001_initial'), 15 ('courses', '0001_initial'),
  16 + migrations.swappable_dependency(settings.AUTH_USER_MODEL),
15 ] 17 ]
16 18
17 operations = [ 19 operations = [
@@ -57,4 +59,14 @@ class Migration(migrations.Migration): @@ -57,4 +59,14 @@ class Migration(migrations.Migration):
57 name='poll', 59 name='poll',
58 field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers_stundet', to='poll.Poll', verbose_name='Poll'), 60 field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers_stundet', to='poll.Poll', verbose_name='Poll'),
59 ), 61 ),
  62 + migrations.AddField(
  63 + model_name='answersstudent',
  64 + name='student',
  65 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers_stundent', to=settings.AUTH_USER_MODEL, verbose_name='Student'),
  66 + ),
  67 + migrations.AddField(
  68 + model_name='answer',
  69 + name='poll',
  70 + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='poll.Poll', verbose_name='Answers'),
  71 + ),
60 ] 72 ]
poll/migrations/0002_auto_20161018_1842.py
@@ -1,30 +0,0 @@ @@ -1,30 +0,0 @@
1 -# -*- coding: utf-8 -*-  
2 -# Generated by Django 1.10 on 2016-10-18 21:42  
3 -from __future__ import unicode_literals  
4 -  
5 -from django.conf import settings  
6 -from django.db import migrations, models  
7 -import django.db.models.deletion  
8 -  
9 -  
10 -class Migration(migrations.Migration):  
11 -  
12 - initial = True  
13 -  
14 - dependencies = [  
15 - migrations.swappable_dependency(settings.AUTH_USER_MODEL),  
16 - ('poll', '0001_initial'),  
17 - ]  
18 -  
19 - operations = [  
20 - migrations.AddField(  
21 - model_name='answersstudent',  
22 - name='student',  
23 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers_stundent', to=settings.AUTH_USER_MODEL, verbose_name='Student'),  
24 - ),  
25 - migrations.AddField(  
26 - model_name='answer',  
27 - name='poll',  
28 - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='poll.Poll', verbose_name='Answers'),  
29 - ),  
30 - ]  
users/migrations/0005_auto_20161021_1131.py 0 → 100644
@@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
  1 +# -*- coding: utf-8 -*-
  2 +# Generated by Django 1.10 on 2016-10-21 14: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', '0004_auto_20161021_0820'),
  12 + ]
  13 +
  14 + operations = [
  15 + migrations.AlterField(
  16 + model_name='user',
  17 + name='birth_date',
  18 + field=models.DateField(null=True, verbose_name='Birth Date'),
  19 + ),
  20 + ]
users/models.py
@@ -21,7 +21,7 @@ class User(AbstractBaseUser, PermissionsMixin): @@ -21,7 +21,7 @@ class User(AbstractBaseUser, PermissionsMixin):
21 state = models.CharField(_('State'), max_length = 30, blank = True) 21 state = models.CharField(_('State'), max_length = 30, blank = True)
22 gender = models.CharField(_('Gender'), max_length = 1, choices = (('M', _('Male')), ('F', _('Female')))) 22 gender = models.CharField(_('Gender'), max_length = 1, choices = (('M', _('Male')), ('F', _('Female'))))
23 image = models.ImageField(verbose_name = _('Image'), blank = True, upload_to = 'users/') 23 image = models.ImageField(verbose_name = _('Image'), blank = True, upload_to = 'users/')
24 - birth_date = models.DateField(_('Birth Date')) 24 + birth_date = models.DateField(_('Birth Date'), null=True)
25 phone = models.CharField(_('Phone'), max_length = 30, blank = True) 25 phone = models.CharField(_('Phone'), max_length = 30, blank = True)
26 cpf = models.CharField(_('Cpf'), max_length = 15, blank = True) 26 cpf = models.CharField(_('Cpf'), max_length = 15, blank = True)
27 type_profile = models.IntegerField(_('Type'), null = True, blank = True, choices = ((1, _('Professor')), (2, _('Student'))), default=2) 27 type_profile = models.IntegerField(_('Type'), null = True, blank = True, choices = ((1, _('Professor')), (2, _('Student'))), default=2)