Commit e168fc9da25166064709c96e8335af1e0a24196d
1 parent
3b30ee82
Exists in
master
and in
5 other branches
algumas alterações nos models
Showing
28 changed files
with
389 additions
and
385 deletions
Show diff stats
.gitignore
app/migrations/0001_initial.py
| 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-14 04:44 | 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 |
| 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 |
core/migrations/0001_initial.py
| 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-14 04:44 | 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 |
| 3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
| 4 | 4 | ||
| 5 | import autoslug.fields | 5 | import autoslug.fields |
| @@ -22,7 +22,7 @@ class Migration(migrations.Migration): | @@ -22,7 +22,7 @@ class Migration(migrations.Migration): | ||
| 22 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | 22 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
| 23 | ('name', models.CharField(max_length=100, verbose_name='Name')), | 23 | ('name', models.CharField(max_length=100, verbose_name='Name')), |
| 24 | ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), | 24 | ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), |
| 25 | - ('created_date', models.DateField(auto_now_add=True, verbose_name='Created Date')), | 25 | + ('created_date', models.DateTimeField(auto_now_add=True, verbose_name='Created Date')), |
| 26 | ], | 26 | ], |
| 27 | options={ | 27 | options={ |
| 28 | 'verbose_name': 'Action', | 28 | 'verbose_name': 'Action', |
| @@ -84,7 +84,7 @@ class Migration(migrations.Migration): | @@ -84,7 +84,7 @@ class Migration(migrations.Migration): | ||
| 84 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | 84 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
| 85 | ('name', models.CharField(max_length=100, verbose_name='Name')), | 85 | ('name', models.CharField(max_length=100, verbose_name='Name')), |
| 86 | ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), | 86 | ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), |
| 87 | - ('created_date', models.DateField(auto_now_add=True, verbose_name='Created Date')), | 87 | + ('created_date', models.DateTimeField(auto_now_add=True, verbose_name='Created Date')), |
| 88 | ('url', models.CharField(default='', max_length=100, verbose_name='URL')), | 88 | ('url', models.CharField(default='', max_length=100, verbose_name='URL')), |
| 89 | ], | 89 | ], |
| 90 | options={ | 90 | options={ |
core/migrations/0002_auto_20161114_0144.py
| @@ -1,50 +0,0 @@ | @@ -1,50 +0,0 @@ | ||
| 1 | -# -*- coding: utf-8 -*- | ||
| 2 | -# Generated by Django 1.10 on 2016-11-14 04:44 | ||
| 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 | - ] |
| @@ -0,0 +1,50 @@ | @@ -0,0 +1,50 @@ | ||
| 1 | +# -*- coding: utf-8 -*- | ||
| 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 | ||
| 3 | +from __future__ import unicode_literals | ||
| 4 | + | ||
| 5 | +from django.conf import settings | ||
| 6 | +from django.db import migrations, models | ||
| 7 | +import django.db.models.deletion | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +class Migration(migrations.Migration): | ||
| 11 | + | ||
| 12 | + initial = True | ||
| 13 | + | ||
| 14 | + dependencies = [ | ||
| 15 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
| 16 | + ('core', '0001_initial'), | ||
| 17 | + ] | ||
| 18 | + | ||
| 19 | + operations = [ | ||
| 20 | + migrations.AddField( | ||
| 21 | + model_name='notification', | ||
| 22 | + name='actor', | ||
| 23 | + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='notification_Performer', to=settings.AUTH_USER_MODEL, verbose_name='Performer'), | ||
| 24 | + ), | ||
| 25 | + migrations.AddField( | ||
| 26 | + model_name='notification', | ||
| 27 | + name='user', | ||
| 28 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notification_Actor', to=settings.AUTH_USER_MODEL, verbose_name='User'), | ||
| 29 | + ), | ||
| 30 | + migrations.AddField( | ||
| 31 | + model_name='log', | ||
| 32 | + name='action_resource', | ||
| 33 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource'), | ||
| 34 | + ), | ||
| 35 | + migrations.AddField( | ||
| 36 | + model_name='log', | ||
| 37 | + name='user', | ||
| 38 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor'), | ||
| 39 | + ), | ||
| 40 | + migrations.AddField( | ||
| 41 | + model_name='action_resource', | ||
| 42 | + name='action', | ||
| 43 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action', verbose_name='Action_Applied'), | ||
| 44 | + ), | ||
| 45 | + migrations.AddField( | ||
| 46 | + model_name='action_resource', | ||
| 47 | + name='resource', | ||
| 48 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Resource', verbose_name='Resource'), | ||
| 49 | + ), | ||
| 50 | + ] |
core/models.py
| @@ -27,7 +27,7 @@ class Action(models.Model): | @@ -27,7 +27,7 @@ class Action(models.Model): | ||
| 27 | 27 | ||
| 28 | name = models.CharField(_('Name'), max_length = 100) | 28 | name = models.CharField(_('Name'), max_length = 100) |
| 29 | slug = AutoSlugField(_("Slug"), populate_from=('name'), unique=True) | 29 | slug = AutoSlugField(_("Slug"), populate_from=('name'), unique=True) |
| 30 | - created_date = models.DateField(_('Created Date'), auto_now_add=True) | 30 | + created_date = models.DateTimeField(_('Created Date'), auto_now_add=True) |
| 31 | 31 | ||
| 32 | class Meta: | 32 | class Meta: |
| 33 | verbose_name = "Action" | 33 | verbose_name = "Action" |
| @@ -51,7 +51,7 @@ class Resource(models.Model): | @@ -51,7 +51,7 @@ class Resource(models.Model): | ||
| 51 | 51 | ||
| 52 | name = models.CharField(_('Name'), max_length =100) | 52 | name = models.CharField(_('Name'), max_length =100) |
| 53 | slug = AutoSlugField(_("Slug"), populate_from='name', unique=True) | 53 | slug = AutoSlugField(_("Slug"), populate_from='name', unique=True) |
| 54 | - created_date = models.DateField(_('Created Date'), auto_now_add=True) | 54 | + created_date = models.DateTimeField(_('Created Date'), auto_now_add=True) |
| 55 | url = models.CharField(_('URL'), max_length =100, default="") | 55 | url = models.CharField(_('URL'), max_length =100, default="") |
| 56 | 56 | ||
| 57 | 57 |
core/templates/register_user.html
| @@ -12,103 +12,108 @@ | @@ -12,103 +12,108 @@ | ||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | {% block content %} | 14 | {% block content %} |
| 15 | - {% if messages %} | ||
| 16 | - {% for message in messages %} | ||
| 17 | - <div class="alert alert-{{ message.tags }} alert-dismissible" role="alert"> | ||
| 18 | - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | ||
| 19 | - <span aria-hidden="true">×</span> | ||
| 20 | - </button> | ||
| 21 | - <p>{{ message }}</p> | ||
| 22 | - </div> | ||
| 23 | - {% endfor %} | ||
| 24 | - {% endif %} | ||
| 25 | - <div class="row"> | ||
| 26 | - <div class="col-lg-offset-4 col-lg-8 col-md-offset-4 col-md-8 col-xs-offset-4 col-xs-8 col-sm-offset-4 col-sm-8"> | ||
| 27 | - <div class="col-lg-8 col-md-8 col-xs-8 col-sm-8"> | ||
| 28 | - <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block " alt="logo amadeus" id="logo"> | ||
| 29 | - </div> | ||
| 30 | - </div> | 15 | +{% if messages %} |
| 16 | +{% for message in messages %} | ||
| 17 | +<div class="alert alert-{{ message.tags }} alert-dismissible" role="alert"> | ||
| 18 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | ||
| 19 | + <span aria-hidden="true">×</span> | ||
| 20 | + </button> | ||
| 21 | + <p>{{ message }}</p> | ||
| 22 | +</div> | ||
| 23 | +{% endfor %} | ||
| 24 | +{% endif %} | ||
| 25 | +<div class="row"> | ||
| 26 | + <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 "> | ||
| 27 | + <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"> | ||
| 28 | + <img src="{% static 'img/amadeus.png' %}" class="img-responsive center-block logo-login " alt="logo amadeus"> | ||
| 31 | </div> | 29 | </div> |
| 30 | + </div> | ||
| 31 | +</div> | ||
| 32 | 32 | ||
| 33 | - <div class="row"> | ||
| 34 | - <div class="col-lg-8 col-lg-offset-3 col-md-8 col-md-offset-3 col-sm-8 col-sm-offset-3 col-xs-8 col-xs-offset-3"> | ||
| 35 | - <div class="card"> | ||
| 36 | - <div class="card-body"> | ||
| 37 | - <form class="form-horizontal" name="registerForm" method="post" action="" enctype="multipart/form-data"> | ||
| 38 | - {% csrf_token %} | ||
| 39 | - <legend>{% trans 'User Register' %}</legend> | ||
| 40 | - {% for field in form %} | ||
| 41 | - <div class="form-group is-empty {% if form.has_error %} has-error {% endif %} is-fileinput"> | ||
| 42 | - {% if field.field.required %} | ||
| 43 | - <label for="{{ field.auto_id }}" class="col-md-2 control-label">{{ field.label }}<span>*</span></label> | ||
| 44 | - {% else %} | ||
| 45 | - <label for="{{ field.auto_id }}" class="col-md-2 control-label">{{ field.label }}</label> | ||
| 46 | - {% endif %} | ||
| 47 | - <div class="col-md-10"> | ||
| 48 | - {% if field.auto_id == 'id_birth_date' %} | ||
| 49 | - {% render_field field class='form-control input-sm date-picker' %} | ||
| 50 | - | ||
| 51 | - <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | ||
| 52 | - {% elif field.auto_id == 'id_image' %} | ||
| 53 | - {% render_field field class='form-control input-sm' %} | ||
| 54 | - <div class="input-group"> | ||
| 55 | - <input type="text" readonly="" class="form-control" placeholder="Choose your photo..."> | ||
| 56 | - <span class="input-group-btn input-group-sm"> | ||
| 57 | - <button type="button" class="btn btn-fab btn-fab-mini"> | ||
| 58 | - <i class="material-icons">attach_file</i> | ||
| 59 | - </button> | ||
| 60 | - </span> | ||
| 61 | - </div> | ||
| 62 | - {% elif field.auto_id == 'id_curriculum' %} | ||
| 63 | - {% render_field field class='form-control input-sm' %} | ||
| 64 | - <div class="input-group"> | ||
| 65 | - <input type="text" readonly="" class="form-control" placeholder="{% trans 'Choose the file ...' %}"> | ||
| 66 | - <span class="input-group-btn input-group-sm"> | ||
| 67 | - <button type="button" class="btn btn-fab btn-fab-mini"> | ||
| 68 | - <i class="material-icons">attach_file</i> | ||
| 69 | - </button> | ||
| 70 | - </span> | ||
| 71 | - </div> | ||
| 72 | - {% elif field.auto_id == 'id_cpf' %} | ||
| 73 | - {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %} | ||
| 74 | - | ||
| 75 | - {% elif field.auto_id == 'id_year_titration' %} | ||
| 76 | - {% render_field field class='form-control' onkeypress='campoNumerico(this,event);' %} | 33 | +<div class="row"> |
| 34 | + <div class="col-lg-8 col-lg-offset-3 col-md-8 col-md-offset-3 col-sm-8 col-sm-offset-3 col-xs-8 col-xs-offset-3"> | ||
| 35 | + <div class="card"> | ||
| 36 | + <div class="card-body"> | ||
| 37 | + <div class="row"> | ||
| 38 | + <div class="col-md-12 text-center"> | ||
| 39 | + <h2 style="color:#43a251"><strong>{% trans "User Register" %}</strong></h2> | ||
| 40 | + </div> | ||
| 41 | + </div> | ||
| 77 | 42 | ||
| 78 | - {% elif field.auto_id == 'id_phone' %} | ||
| 79 | - {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %} | ||
| 80 | - {% else %} | ||
| 81 | - {% render_field field class='form-control' %} | ||
| 82 | - <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | ||
| 83 | - {% endif %} | ||
| 84 | - </div> | 43 | + <form class="form-horizontal" name="registerForm" method="post" action="" enctype="multipart/form-data"> |
| 44 | + {% csrf_token %} | ||
| 45 | + {% for field in form %} | ||
| 46 | + <div class="form-group is-empty {% if form.has_error %} has-error {% endif %} is-fileinput"> | ||
| 47 | + {% if field.field.required %} | ||
| 48 | + <label for="{{ field.auto_id }}" class="col-md-2 control-label">{{ field.label }}<span>*</span></label> | ||
| 49 | + {% else %} | ||
| 50 | + <label for="{{ field.auto_id }}" class="col-md-2 control-label">{{ field.label }}</label> | ||
| 51 | + {% endif %} | ||
| 52 | + <div class="col-md-10"> | ||
| 53 | + {% if field.auto_id == 'id_birth_date' %} | ||
| 54 | + {% render_field field class='form-control input-sm date-picker' %} | ||
| 85 | 55 | ||
| 86 | - {% if field.errors %} | ||
| 87 | - <div class="alert alert-danger alert-dismissible col-md-offset-1 col-md-10 col-sm-offset-1 col-sm-10 col-xs-offset-1 col-xs-10" role="alert"> | ||
| 88 | - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | ||
| 89 | - <span aria-hidden="true">×</span> | ||
| 90 | - </button> | ||
| 91 | - <ul> | ||
| 92 | - {% for error in field.errors %} | ||
| 93 | - <li>{{ error }}</li> | ||
| 94 | - {% endfor %} | ||
| 95 | - </ul> | ||
| 96 | - </div> | ||
| 97 | - {% endif %} | ||
| 98 | - </div> | ||
| 99 | - {% endfor %} | ||
| 100 | - <div class="col-md-offset-2 col-md-6 col-sm-offset-2 col-sm-6 col-xs-6 col-xs-offset-2 col-xs-6"> | ||
| 101 | - <input type="submit" value="{% trans 'Save' %}" class="btn btn-raised btn-primary" /> | 56 | + <span id="helpBlock" class="help-block">{{ field.help_text }}</span> |
| 57 | + {% elif field.auto_id == 'id_image' %} | ||
| 58 | + {% render_field field class='form-control input-sm' %} | ||
| 59 | + <div class="input-group"> | ||
| 60 | + <input type="text" readonly="" class="form-control" placeholder="Choose your photo..."> | ||
| 61 | + <span class="input-group-btn input-group-sm"> | ||
| 62 | + <button type="button" class="btn btn-fab btn-fab-mini"> | ||
| 63 | + <i class="material-icons">image</i> | ||
| 64 | + </button> | ||
| 65 | + </span> | ||
| 102 | </div> | 66 | </div> |
| 103 | - <div class=" col-md-4 col-sm-4 col-xs-4"> | ||
| 104 | - <a href="{% url 'core:home' %}" class=" btn btn-danger btn-raised" >{% trans 'Cancel' %}</a> | 67 | + {% elif field.auto_id == 'id_curriculum' %} |
| 68 | + {% render_field field class='form-control input-sm' %} | ||
| 69 | + <div class="input-group"> | ||
| 70 | + <input type="text" readonly="" class="form-control" placeholder="{% trans 'Choose the file ...' %}"> | ||
| 71 | + <span class="input-group-btn input-group-sm"> | ||
| 72 | + <button type="button" class="btn btn-fab btn-fab-mini"> | ||
| 73 | + <i class="material-icons">attach_file</i> | ||
| 74 | + </button> | ||
| 75 | + </span> | ||
| 105 | </div> | 76 | </div> |
| 77 | + {% elif field.auto_id == 'id_cpf' %} | ||
| 78 | + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarCpf(this,event);' %} | ||
| 79 | + | ||
| 80 | + {% elif field.auto_id == 'id_year_titration' %} | ||
| 81 | + {% render_field field class='form-control' onkeypress='campoNumerico(this,event);' %} | ||
| 106 | 82 | ||
| 107 | - </form> | 83 | + {% elif field.auto_id == 'id_phone' %} |
| 84 | + {% render_field field class='form-control' onkeypress='campoNumerico(this,event); formatarTelefone(this,event);' %} | ||
| 85 | + {% else %} | ||
| 86 | + {% render_field field class='form-control' %} | ||
| 87 | + <span id="helpBlock" class="help-block">{{ field.help_text }}</span> | ||
| 88 | + {% endif %} | ||
| 89 | + </div> | ||
| 90 | + | ||
| 91 | + {% if field.errors %} | ||
| 92 | + <div class="alert alert-danger alert-dismissible col-md-offset-1 col-md-10 col-sm-offset-1 col-sm-10 col-xs-offset-1 col-xs-10" role="alert"> | ||
| 93 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | ||
| 94 | + <span aria-hidden="true">×</span> | ||
| 95 | + </button> | ||
| 96 | + <ul> | ||
| 97 | + {% for error in field.errors %} | ||
| 98 | + <li>{{ error }}</li> | ||
| 99 | + {% endfor %} | ||
| 100 | + </ul> | ||
| 101 | + </div> | ||
| 102 | + {% endif %} | ||
| 103 | + </div> | ||
| 104 | + {% endfor %} | ||
| 105 | + <div class="col-md-offset-2 col-md-6 col-sm-offset-2 col-sm-6 col-xs-6 col-xs-offset-2 col-xs-6"> | ||
| 106 | + <input type="submit" value="{% trans 'Save' %}" class="btn btn-raised btn-primary" /> | ||
| 108 | </div> | 107 | </div> |
| 108 | + <div class=" col-md-4 col-sm-4 col-xs-4"> | ||
| 109 | + <a href="{% url 'core:home' %}" class=" btn btn-danger btn-raised" >{% trans 'Cancel' %}</a> | ||
| 110 | + </div> | ||
| 111 | + | ||
| 112 | + </form> | ||
| 109 | </div> | 113 | </div> |
| 110 | </div> | 114 | </div> |
| 111 | </div> | 115 | </div> |
| 116 | +</div> | ||
| 112 | 117 | ||
| 113 | - <br clear="all" /> | 118 | +<br clear="all" /> |
| 114 | {% endblock %} | 119 | {% endblock %} |
courses/migrations/0001_initial.py
| 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-14 04:44 | 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 |
| 3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
| 4 | 4 | ||
| 5 | import autoslug.fields | 5 | import autoslug.fields |
| @@ -44,7 +44,7 @@ class Migration(migrations.Migration): | @@ -44,7 +44,7 @@ class Migration(migrations.Migration): | ||
| 44 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | 44 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
| 45 | ('name', models.CharField(max_length=100, unique=True, verbose_name='Name')), | 45 | ('name', models.CharField(max_length=100, unique=True, verbose_name='Name')), |
| 46 | ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), | 46 | ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), |
| 47 | - ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), | 47 | + ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), |
| 48 | ], | 48 | ], |
| 49 | options={ | 49 | options={ |
| 50 | 'verbose_name': 'Category', | 50 | 'verbose_name': 'Category', |
| @@ -60,7 +60,7 @@ class Migration(migrations.Migration): | @@ -60,7 +60,7 @@ class Migration(migrations.Migration): | ||
| 60 | ('objectivies', models.TextField(blank=True, verbose_name='Objectivies')), | 60 | ('objectivies', models.TextField(blank=True, verbose_name='Objectivies')), |
| 61 | ('content', models.TextField(blank=True, verbose_name='Content')), | 61 | ('content', models.TextField(blank=True, verbose_name='Content')), |
| 62 | ('max_students', models.PositiveIntegerField(blank=True, verbose_name='Maximum Students')), | 62 | ('max_students', models.PositiveIntegerField(blank=True, verbose_name='Maximum Students')), |
| 63 | - ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), | 63 | + ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), |
| 64 | ('init_register_date', models.DateField(verbose_name='Register Date (Begin)')), | 64 | ('init_register_date', models.DateField(verbose_name='Register Date (Begin)')), |
| 65 | ('end_register_date', models.DateField(verbose_name='Register Date (End)')), | 65 | ('end_register_date', models.DateField(verbose_name='Register Date (End)')), |
| 66 | ('init_date', models.DateField(verbose_name='Begin of Course Date')), | 66 | ('init_date', models.DateField(verbose_name='Begin of Course Date')), |
| @@ -68,9 +68,9 @@ class Migration(migrations.Migration): | @@ -68,9 +68,9 @@ class Migration(migrations.Migration): | ||
| 68 | ('public', models.BooleanField(default=False, verbose_name='Public')), | 68 | ('public', models.BooleanField(default=False, verbose_name='Public')), |
| 69 | ], | 69 | ], |
| 70 | options={ | 70 | options={ |
| 71 | - 'ordering': ('create_date', 'name'), | ||
| 72 | 'verbose_name': 'Course', | 71 | 'verbose_name': 'Course', |
| 73 | 'verbose_name_plural': 'Courses', | 72 | 'verbose_name_plural': 'Courses', |
| 73 | + 'ordering': ('create_date', 'name'), | ||
| 74 | }, | 74 | }, |
| 75 | ), | 75 | ), |
| 76 | migrations.CreateModel( | 76 | migrations.CreateModel( |
| @@ -79,7 +79,7 @@ class Migration(migrations.Migration): | @@ -79,7 +79,7 @@ class Migration(migrations.Migration): | ||
| 79 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | 79 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
| 80 | ('name', models.CharField(max_length=100, unique=True, verbose_name='Name')), | 80 | ('name', models.CharField(max_length=100, unique=True, verbose_name='Name')), |
| 81 | ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), | 81 | ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), |
| 82 | - ('create_date', models.DateField(auto_now_add=True, verbose_name='Creation Date')), | 82 | + ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), |
| 83 | ], | 83 | ], |
| 84 | options={ | 84 | options={ |
| 85 | 'verbose_name': 'Category', | 85 | 'verbose_name': 'Category', |
| @@ -123,11 +123,13 @@ class Migration(migrations.Migration): | @@ -123,11 +123,13 @@ class Migration(migrations.Migration): | ||
| 123 | ('end_date', models.DateField(verbose_name='End of Subject Date')), | 123 | ('end_date', models.DateField(verbose_name='End of Subject Date')), |
| 124 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), | 124 | ('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')), | 125 | ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), |
| 126 | + ('category', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='subject_category', to='courses.CategorySubject', verbose_name='Category')), | ||
| 127 | + ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subjects', to='courses.Course', verbose_name='Course')), | ||
| 126 | ], | 128 | ], |
| 127 | options={ | 129 | options={ |
| 128 | - 'ordering': ('create_date', 'name'), | ||
| 129 | 'verbose_name': 'Subject', | 130 | 'verbose_name': 'Subject', |
| 130 | 'verbose_name_plural': 'Subjects', | 131 | 'verbose_name_plural': 'Subjects', |
| 132 | + 'ordering': ('create_date', 'name'), | ||
| 131 | }, | 133 | }, |
| 132 | ), | 134 | ), |
| 133 | migrations.CreateModel( | 135 | migrations.CreateModel( |
| @@ -137,6 +139,7 @@ class Migration(migrations.Migration): | @@ -137,6 +139,7 @@ class Migration(migrations.Migration): | ||
| 137 | ('name', models.CharField(max_length=100, verbose_name='Name')), | 139 | ('name', models.CharField(max_length=100, verbose_name='Name')), |
| 138 | ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), | 140 | ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True, verbose_name='Slug')), |
| 139 | ('description', models.TextField(blank=True, verbose_name='Description')), | 141 | ('description', models.TextField(blank=True, verbose_name='Description')), |
| 142 | + ('subjects', models.ManyToManyField(to='courses.Subject')), | ||
| 140 | ], | 143 | ], |
| 141 | options={ | 144 | options={ |
| 142 | 'verbose_name': 'subject category', | 145 | 'verbose_name': 'subject category', |
| @@ -153,11 +156,12 @@ class Migration(migrations.Migration): | @@ -153,11 +156,12 @@ class Migration(migrations.Migration): | ||
| 153 | ('create_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation Date')), | 156 | ('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')), | 157 | ('update_date', models.DateTimeField(auto_now=True, verbose_name='Date of last update')), |
| 155 | ('visible', models.BooleanField(default=False, verbose_name='Visible')), | 158 | ('visible', models.BooleanField(default=False, verbose_name='Visible')), |
| 159 | + ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Subject', verbose_name='Subject')), | ||
| 156 | ], | 160 | ], |
| 157 | options={ | 161 | options={ |
| 158 | - 'ordering': ('create_date', 'name'), | ||
| 159 | 'verbose_name': 'Topic', | 162 | 'verbose_name': 'Topic', |
| 160 | 'verbose_name_plural': 'Topics', | 163 | 'verbose_name_plural': 'Topics', |
| 164 | + 'ordering': ('create_date', 'name'), | ||
| 161 | }, | 165 | }, |
| 162 | ), | 166 | ), |
| 163 | ] | 167 | ] |
courses/migrations/0002_auto_20161114_0144.py
| @@ -1,110 +0,0 @@ | @@ -1,110 +0,0 @@ | ||
| 1 | -# -*- coding: utf-8 -*- | ||
| 2 | -# Generated by Django 1.10 on 2016-11-14 04:44 | ||
| 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(blank=True, 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='coordenator', | ||
| 83 | - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='course_coordenator', to=settings.AUTH_USER_MODEL, verbose_name='Coordenator'), | ||
| 84 | - ), | ||
| 85 | - migrations.AddField( | ||
| 86 | - model_name='course', | ||
| 87 | - name='professors', | ||
| 88 | - field=models.ManyToManyField(related_name='courses_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | ||
| 89 | - ), | ||
| 90 | - migrations.AddField( | ||
| 91 | - model_name='course', | ||
| 92 | - name='students', | ||
| 93 | - field=models.ManyToManyField(blank=True, related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | ||
| 94 | - ), | ||
| 95 | - migrations.AddField( | ||
| 96 | - model_name='activityfile', | ||
| 97 | - name='diet', | ||
| 98 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='courses.Activity'), | ||
| 99 | - ), | ||
| 100 | - migrations.AddField( | ||
| 101 | - model_name='activity', | ||
| 102 | - name='students', | ||
| 103 | - field=models.ManyToManyField(related_name='activities', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | ||
| 104 | - ), | ||
| 105 | - migrations.AddField( | ||
| 106 | - model_name='activity', | ||
| 107 | - name='topic', | ||
| 108 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'), | ||
| 109 | - ), | ||
| 110 | - ] |
| @@ -0,0 +1,85 @@ | @@ -0,0 +1,85 @@ | ||
| 1 | +# -*- coding: utf-8 -*- | ||
| 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 | ||
| 3 | +from __future__ import unicode_literals | ||
| 4 | + | ||
| 5 | +from django.conf import settings | ||
| 6 | +from django.db import migrations, models | ||
| 7 | +import django.db.models.deletion | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +class Migration(migrations.Migration): | ||
| 11 | + | ||
| 12 | + initial = True | ||
| 13 | + | ||
| 14 | + dependencies = [ | ||
| 15 | + ('courses', '0001_initial'), | ||
| 16 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
| 17 | + ] | ||
| 18 | + | ||
| 19 | + operations = [ | ||
| 20 | + migrations.AddField( | ||
| 21 | + model_name='subject', | ||
| 22 | + name='professors', | ||
| 23 | + field=models.ManyToManyField(related_name='professors_subjects', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | ||
| 24 | + ), | ||
| 25 | + migrations.AddField( | ||
| 26 | + model_name='subject', | ||
| 27 | + name='students', | ||
| 28 | + field=models.ManyToManyField(blank=True, related_name='subject_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | ||
| 29 | + ), | ||
| 30 | + migrations.AddField( | ||
| 31 | + model_name='material', | ||
| 32 | + name='students', | ||
| 33 | + field=models.ManyToManyField(related_name='materials', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | ||
| 34 | + ), | ||
| 35 | + migrations.AddField( | ||
| 36 | + model_name='material', | ||
| 37 | + name='topic', | ||
| 38 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='materials', to='courses.Topic', verbose_name='Topic'), | ||
| 39 | + ), | ||
| 40 | + migrations.AddField( | ||
| 41 | + model_name='linkmaterial', | ||
| 42 | + name='material', | ||
| 43 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_link', to='courses.Material', verbose_name='Material'), | ||
| 44 | + ), | ||
| 45 | + migrations.AddField( | ||
| 46 | + model_name='filematerial', | ||
| 47 | + name='material', | ||
| 48 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='material_file', to='courses.Material', verbose_name='Material'), | ||
| 49 | + ), | ||
| 50 | + migrations.AddField( | ||
| 51 | + model_name='course', | ||
| 52 | + name='category', | ||
| 53 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_category', to='courses.CourseCategory', verbose_name='Category'), | ||
| 54 | + ), | ||
| 55 | + migrations.AddField( | ||
| 56 | + model_name='course', | ||
| 57 | + name='coordenator', | ||
| 58 | + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='course_coordenator', to=settings.AUTH_USER_MODEL, verbose_name='Coordenator'), | ||
| 59 | + ), | ||
| 60 | + migrations.AddField( | ||
| 61 | + model_name='course', | ||
| 62 | + name='professors', | ||
| 63 | + field=models.ManyToManyField(related_name='courses_professors', to=settings.AUTH_USER_MODEL, verbose_name='Professors'), | ||
| 64 | + ), | ||
| 65 | + migrations.AddField( | ||
| 66 | + model_name='course', | ||
| 67 | + name='students', | ||
| 68 | + field=models.ManyToManyField(blank=True, related_name='courses_student', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | ||
| 69 | + ), | ||
| 70 | + migrations.AddField( | ||
| 71 | + model_name='activityfile', | ||
| 72 | + name='diet', | ||
| 73 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='files', to='courses.Activity'), | ||
| 74 | + ), | ||
| 75 | + migrations.AddField( | ||
| 76 | + model_name='activity', | ||
| 77 | + name='students', | ||
| 78 | + field=models.ManyToManyField(related_name='activities', to=settings.AUTH_USER_MODEL, verbose_name='Students'), | ||
| 79 | + ), | ||
| 80 | + migrations.AddField( | ||
| 81 | + model_name='activity', | ||
| 82 | + name='topic', | ||
| 83 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='courses.Topic', verbose_name='Topic'), | ||
| 84 | + ), | ||
| 85 | + ] |
courses/models.py
| @@ -13,7 +13,7 @@ class CourseCategory(models.Model): | @@ -13,7 +13,7 @@ class CourseCategory(models.Model): | ||
| 13 | 13 | ||
| 14 | name = models.CharField(_('Name'), max_length = 100, unique = True) | 14 | name = models.CharField(_('Name'), max_length = 100, unique = True) |
| 15 | slug = AutoSlugField(_("Slug"),populate_from='name',unique=True) | 15 | slug = AutoSlugField(_("Slug"),populate_from='name',unique=True) |
| 16 | - create_date = models.DateField(_('Creation Date'), auto_now_add = True) | 16 | + create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) |
| 17 | 17 | ||
| 18 | class Meta: | 18 | class Meta: |
| 19 | verbose_name = _('Category') | 19 | verbose_name = _('Category') |
| @@ -25,7 +25,7 @@ class CourseCategory(models.Model): | @@ -25,7 +25,7 @@ class CourseCategory(models.Model): | ||
| 25 | class CategorySubject(models.Model): | 25 | class CategorySubject(models.Model): |
| 26 | name = models.CharField(_('Name'), max_length=100, unique=True) | 26 | name = models.CharField(_('Name'), max_length=100, unique=True) |
| 27 | slug = AutoSlugField(_("Slug"), populate_from='name', unique=True) | 27 | slug = AutoSlugField(_("Slug"), populate_from='name', unique=True) |
| 28 | - create_date = models.DateField(_('Creation Date'), auto_now_add=True) | 28 | + create_date = models.DateTimeField(_('Creation Date'), auto_now_add=True) |
| 29 | 29 | ||
| 30 | class Meta: | 30 | class Meta: |
| 31 | verbose_name = _('Category') | 31 | verbose_name = _('Category') |
| @@ -41,7 +41,7 @@ class Course(models.Model): | @@ -41,7 +41,7 @@ class Course(models.Model): | ||
| 41 | objectivies = models.TextField(_('Objectivies'), blank = True) | 41 | objectivies = models.TextField(_('Objectivies'), blank = True) |
| 42 | content = models.TextField(_('Content'), blank = True) | 42 | content = models.TextField(_('Content'), blank = True) |
| 43 | max_students = models.PositiveIntegerField(_('Maximum Students'), blank = True) | 43 | max_students = models.PositiveIntegerField(_('Maximum Students'), blank = True) |
| 44 | - create_date = models.DateField(_('Creation Date'), auto_now_add = True) | 44 | + create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) |
| 45 | init_register_date = models.DateField(_('Register Date (Begin)')) | 45 | init_register_date = models.DateField(_('Register Date (Begin)')) |
| 46 | end_register_date = models.DateField(_('Register Date (End)')) | 46 | end_register_date = models.DateField(_('Register Date (End)')) |
| 47 | init_date = models.DateField(_('Begin of Course Date')) | 47 | init_date = models.DateField(_('Begin of Course Date')) |
| @@ -106,7 +106,6 @@ class Topic(models.Model): | @@ -106,7 +106,6 @@ class Topic(models.Model): | ||
| 106 | create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) | 106 | create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) |
| 107 | update_date = models.DateTimeField(_('Date of last update'), auto_now=True) | 107 | update_date = models.DateTimeField(_('Date of last update'), auto_now=True) |
| 108 | subject = models.ForeignKey(Subject, verbose_name = _('Subject')) | 108 | subject = models.ForeignKey(Subject, verbose_name = _('Subject')) |
| 109 | - owner = models.ForeignKey(User, verbose_name = _('Owner')) | ||
| 110 | visible = models.BooleanField(_('Visible'), default=False) | 109 | visible = models.BooleanField(_('Visible'), default=False) |
| 111 | 110 | ||
| 112 | class Meta: | 111 | class Meta: |
courses/views.py
| @@ -429,7 +429,7 @@ class FilteredView(LoginRequiredMixin, generic.ListView): | @@ -429,7 +429,7 @@ class FilteredView(LoginRequiredMixin, generic.ListView): | ||
| 429 | redirect_field_name = 'next' | 429 | redirect_field_name = 'next' |
| 430 | template_name = 'course/filtered.html' | 430 | template_name = 'course/filtered.html' |
| 431 | context_object_name = 'courses' | 431 | context_object_name = 'courses' |
| 432 | - paginate_by = 3 | 432 | + paginate_by = 10 |
| 433 | 433 | ||
| 434 | def get_queryset(self): | 434 | def get_queryset(self): |
| 435 | category = get_object_or_404(CourseCategory, slug = self.kwargs.get('slug')) | 435 | category = get_object_or_404(CourseCategory, slug = self.kwargs.get('slug')) |
| @@ -447,11 +447,11 @@ class IndexCatView(LoginRequiredMixin, generic.ListView): | @@ -447,11 +447,11 @@ class IndexCatView(LoginRequiredMixin, generic.ListView): | ||
| 447 | 447 | ||
| 448 | login_url = reverse_lazy("core:home") | 448 | login_url = reverse_lazy("core:home") |
| 449 | redirect_field_name = 'next' | 449 | redirect_field_name = 'next' |
| 450 | - queryset = sorted(CourseCategory.objects.all(),key = lambda x:x.name) | 450 | + queryset = CourseCategory.objects.all().order_by("name") |
| 451 | template_name = 'category/index.html' | 451 | template_name = 'category/index.html' |
| 452 | context_object_name = 'categories' | 452 | context_object_name = 'categories' |
| 453 | - paginate_by = 5 | ||
| 454 | - | 453 | + paginate_by = 10 |
| 454 | + | ||
| 455 | class CreateCatView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView): | 455 | class CreateCatView(LoginRequiredMixin, HasRoleMixin, generic.edit.CreateView): |
| 456 | 456 | ||
| 457 | allowed_roles = ['professor', 'system_admin'] | 457 | allowed_roles = ['professor', 'system_admin'] |
| @@ -589,7 +589,7 @@ class ReplicateSubjectView(LoginRequiredMixin, HasRoleMixin, LogMixin, Notificat | @@ -589,7 +589,7 @@ class ReplicateSubjectView(LoginRequiredMixin, HasRoleMixin, LogMixin, Notificat | ||
| 589 | 589 | ||
| 590 | def form_valid(self, form): | 590 | def form_valid(self, form): |
| 591 | self.object = form.save() | 591 | self.object = form.save() |
| 592 | - | 592 | + |
| 593 | return super(ReplicateSubjectView, self).form_valid(form) | 593 | return super(ReplicateSubjectView, self).form_valid(form) |
| 594 | 594 | ||
| 595 | def get_success_url(self): | 595 | def get_success_url(self): |
| @@ -1065,4 +1065,4 @@ class ReplicateTopicView (LoginRequiredMixin, HasRoleMixin, LogMixin, Notificati | @@ -1065,4 +1065,4 @@ class ReplicateTopicView (LoginRequiredMixin, HasRoleMixin, LogMixin, Notificati | ||
| 1065 | 1065 | ||
| 1066 | super(ReplicateTopicView, self).createLog(self.request.user, self.log_component, self.log_action, self.log_resource, self.log_context) | 1066 | super(ReplicateTopicView, self).createLog(self.request.user, self.log_component, self.log_action, self.log_resource, self.log_context) |
| 1067 | 1067 | ||
| 1068 | - return super(ReplicateTopicView, self).form_valid(form) | ||
| 1069 | \ No newline at end of file | 1068 | \ No newline at end of file |
| 1069 | + return super(ReplicateTopicView, self).form_valid(form) |
exam/migrations/0001_initial.py
| 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-14 04:44 | 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 |
| 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,9 +23,9 @@ class Migration(migrations.Migration): | @@ -23,9 +23,9 @@ class Migration(migrations.Migration): | ||
| 23 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), | 23 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), |
| 24 | ], | 24 | ], |
| 25 | options={ | 25 | options={ |
| 26 | - 'ordering': ('order',), | ||
| 27 | 'verbose_name': 'Answer', | 26 | 'verbose_name': 'Answer', |
| 28 | 'verbose_name_plural': 'Answers', | 27 | 'verbose_name_plural': 'Answers', |
| 28 | + 'ordering': ('order',), | ||
| 29 | }, | 29 | }, |
| 30 | ), | 30 | ), |
| 31 | migrations.CreateModel( | 31 | migrations.CreateModel( |
exam/migrations/0002_auto_20161114_0144.py
| @@ -1,30 +0,0 @@ | @@ -1,30 +0,0 @@ | ||
| 1 | -# -*- coding: utf-8 -*- | ||
| 2 | -# Generated by Django 1.10 on 2016-11-14 04:44 | ||
| 3 | -from __future__ import unicode_literals | ||
| 4 | - | ||
| 5 | -from django.conf import settings | ||
| 6 | -from django.db import migrations, models | ||
| 7 | -import django.db.models.deletion | ||
| 8 | - | ||
| 9 | - | ||
| 10 | -class Migration(migrations.Migration): | ||
| 11 | - | ||
| 12 | - initial = True | ||
| 13 | - | ||
| 14 | - dependencies = [ | ||
| 15 | - ('exam', '0001_initial'), | ||
| 16 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
| 17 | - ] | ||
| 18 | - | ||
| 19 | - operations = [ | ||
| 20 | - migrations.AddField( | ||
| 21 | - model_name='answersstudent', | ||
| 22 | - name='student', | ||
| 23 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student', to=settings.AUTH_USER_MODEL, verbose_name='Student'), | ||
| 24 | - ), | ||
| 25 | - migrations.AddField( | ||
| 26 | - model_name='answer', | ||
| 27 | - name='exam', | ||
| 28 | - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='exam.Exam', verbose_name='Answers'), | ||
| 29 | - ), | ||
| 30 | - ] |
| @@ -0,0 +1,30 @@ | @@ -0,0 +1,30 @@ | ||
| 1 | +# -*- coding: utf-8 -*- | ||
| 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 | ||
| 3 | +from __future__ import unicode_literals | ||
| 4 | + | ||
| 5 | +from django.conf import settings | ||
| 6 | +from django.db import migrations, models | ||
| 7 | +import django.db.models.deletion | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +class Migration(migrations.Migration): | ||
| 11 | + | ||
| 12 | + initial = True | ||
| 13 | + | ||
| 14 | + dependencies = [ | ||
| 15 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
| 16 | + ('exam', '0001_initial'), | ||
| 17 | + ] | ||
| 18 | + | ||
| 19 | + operations = [ | ||
| 20 | + migrations.AddField( | ||
| 21 | + model_name='answersstudent', | ||
| 22 | + name='student', | ||
| 23 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student', to=settings.AUTH_USER_MODEL, verbose_name='Student'), | ||
| 24 | + ), | ||
| 25 | + migrations.AddField( | ||
| 26 | + model_name='answer', | ||
| 27 | + name='exam', | ||
| 28 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='exam.Exam', verbose_name='Answers'), | ||
| 29 | + ), | ||
| 30 | + ] |
exercise/migrations/0001_initial.py
| 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-14 04:44 | 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 |
| 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 |
files/migrations/0001_initial.py
| 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-14 04:44 | 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 |
| 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 |
| @@ -26,9 +26,9 @@ class Migration(migrations.Migration): | @@ -26,9 +26,9 @@ class Migration(migrations.Migration): | ||
| 26 | ('file_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topic_files', to='core.MimeType', verbose_name='Type file')), | 26 | ('file_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topic_files', to='core.MimeType', verbose_name='Type file')), |
| 27 | ], | 27 | ], |
| 28 | options={ | 28 | options={ |
| 29 | - 'ordering': ('-id',), | ||
| 30 | 'verbose_name': 'File', | 29 | 'verbose_name': 'File', |
| 31 | 'verbose_name_plural': 'Files', | 30 | 'verbose_name_plural': 'Files', |
| 31 | + 'ordering': ('-id',), | ||
| 32 | }, | 32 | }, |
| 33 | bases=('courses.material',), | 33 | bases=('courses.material',), |
| 34 | ), | 34 | ), |
files/migrations/0002_topicfile_professor.py
| 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-14 04:44 | 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 |
| 3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
| 4 | 4 | ||
| 5 | from django.conf import settings | 5 | from django.conf import settings |
| @@ -11,8 +11,8 @@ class Migration(migrations.Migration): | @@ -11,8 +11,8 @@ class Migration(migrations.Migration): | ||
| 11 | initial = True | 11 | initial = True |
| 12 | 12 | ||
| 13 | dependencies = [ | 13 | dependencies = [ |
| 14 | - ('files', '0001_initial'), | ||
| 15 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), | 14 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), |
| 15 | + ('files', '0001_initial'), | ||
| 16 | ] | 16 | ] |
| 17 | 17 | ||
| 18 | operations = [ | 18 | operations = [ |
forum/migrations/0001_initial.py
| 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-14 04:44 | 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 |
| 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 |
forum/migrations/0002_auto_20161114_0144.py
| @@ -1,35 +0,0 @@ | @@ -1,35 +0,0 @@ | ||
| 1 | -# -*- coding: utf-8 -*- | ||
| 2 | -# Generated by Django 1.10 on 2016-11-14 04:44 | ||
| 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 | - ] |
| @@ -0,0 +1,35 @@ | @@ -0,0 +1,35 @@ | ||
| 1 | +# -*- coding: utf-8 -*- | ||
| 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 | ||
| 3 | +from __future__ import unicode_literals | ||
| 4 | + | ||
| 5 | +from django.conf import settings | ||
| 6 | +from django.db import migrations, models | ||
| 7 | +import django.db.models.deletion | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +class Migration(migrations.Migration): | ||
| 11 | + | ||
| 12 | + initial = True | ||
| 13 | + | ||
| 14 | + dependencies = [ | ||
| 15 | + ('forum', '0001_initial'), | ||
| 16 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
| 17 | + ] | ||
| 18 | + | ||
| 19 | + operations = [ | ||
| 20 | + migrations.AddField( | ||
| 21 | + model_name='postanswer', | ||
| 22 | + name='user', | ||
| 23 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor'), | ||
| 24 | + ), | ||
| 25 | + migrations.AddField( | ||
| 26 | + model_name='post', | ||
| 27 | + name='forum', | ||
| 28 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.Forum', verbose_name='Forum'), | ||
| 29 | + ), | ||
| 30 | + migrations.AddField( | ||
| 31 | + model_name='post', | ||
| 32 | + name='user', | ||
| 33 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Autor'), | ||
| 34 | + ), | ||
| 35 | + ] |
links/migrations/0001_initial.py
| 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-14 04:44 | 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 |
| 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 |
poll/migrations/0001_initial.py
| 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-14 04:44 | 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 |
| 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,9 +23,9 @@ class Migration(migrations.Migration): | @@ -23,9 +23,9 @@ class Migration(migrations.Migration): | ||
| 23 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), | 23 | ('order', models.PositiveSmallIntegerField(verbose_name='Order')), |
| 24 | ], | 24 | ], |
| 25 | options={ | 25 | options={ |
| 26 | - 'ordering': ('order',), | ||
| 27 | 'verbose_name': 'Answer', | 26 | 'verbose_name': 'Answer', |
| 28 | 'verbose_name_plural': 'Answers', | 27 | 'verbose_name_plural': 'Answers', |
| 28 | + 'ordering': ('order',), | ||
| 29 | }, | 29 | }, |
| 30 | ), | 30 | ), |
| 31 | migrations.CreateModel( | 31 | migrations.CreateModel( |
poll/migrations/0002_auto_20161114_0144.py
| @@ -1,30 +0,0 @@ | @@ -1,30 +0,0 @@ | ||
| 1 | -# -*- coding: utf-8 -*- | ||
| 2 | -# Generated by Django 1.10 on 2016-11-14 04:44 | ||
| 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 | - ] |
| @@ -0,0 +1,30 @@ | @@ -0,0 +1,30 @@ | ||
| 1 | +# -*- coding: utf-8 -*- | ||
| 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 | ||
| 3 | +from __future__ import unicode_literals | ||
| 4 | + | ||
| 5 | +from django.conf import settings | ||
| 6 | +from django.db import migrations, models | ||
| 7 | +import django.db.models.deletion | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +class Migration(migrations.Migration): | ||
| 11 | + | ||
| 12 | + initial = True | ||
| 13 | + | ||
| 14 | + dependencies = [ | ||
| 15 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
| 16 | + ('poll', '0001_initial'), | ||
| 17 | + ] | ||
| 18 | + | ||
| 19 | + operations = [ | ||
| 20 | + migrations.AddField( | ||
| 21 | + model_name='answersstudent', | ||
| 22 | + name='student', | ||
| 23 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers_stundent', to=settings.AUTH_USER_MODEL, verbose_name='Student'), | ||
| 24 | + ), | ||
| 25 | + migrations.AddField( | ||
| 26 | + model_name='answer', | ||
| 27 | + name='poll', | ||
| 28 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='poll.Poll', verbose_name='Answers'), | ||
| 29 | + ), | ||
| 30 | + ] |
users/migrations/0001_initial.py
| 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
| 2 | -# Generated by Django 1.10 on 2016-11-14 04:44 | 2 | +# Generated by Django 1.10 on 2016-11-15 22:36 |
| 3 | from __future__ import unicode_literals | 3 | from __future__ import unicode_literals |
| 4 | 4 | ||
| 5 | import django.contrib.auth.models | 5 | import django.contrib.auth.models |
| @@ -26,14 +26,14 @@ class Migration(migrations.Migration): | @@ -26,14 +26,14 @@ class Migration(migrations.Migration): | ||
| 26 | ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), | 26 | ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), |
| 27 | ('username', models.CharField(help_text='A short name that will be used to identify you in the platform and to access it', max_length=35, unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[\\w.@+-]+$', 32), 'Type a valid username. This fields should only contain letters, numbers and the characteres: @/./+/-/_ .', 'invalid')], verbose_name='Login')), | 27 | ('username', models.CharField(help_text='A short name that will be used to identify you in the platform and to access it', max_length=35, unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[\\w.@+-]+$', 32), 'Type a valid username. This fields should only contain letters, numbers and the characteres: @/./+/-/_ .', 'invalid')], verbose_name='Login')), |
| 28 | ('email', models.EmailField(max_length=254, unique=True, verbose_name='Mail')), | 28 | ('email', models.EmailField(max_length=254, unique=True, verbose_name='Mail')), |
| 29 | - ('name', models.CharField(blank=True, max_length=100, verbose_name='Name')), | 29 | + ('name', models.CharField(max_length=100, verbose_name='Name')), |
| 30 | ('city', models.CharField(blank=True, max_length=90, verbose_name='City')), | 30 | ('city', models.CharField(blank=True, max_length=90, verbose_name='City')), |
| 31 | ('state', models.CharField(blank=True, max_length=30, verbose_name='State')), | 31 | ('state', models.CharField(blank=True, max_length=30, verbose_name='State')), |
| 32 | ('gender', models.CharField(choices=[('M', 'Male'), ('F', 'Female')], max_length=1, verbose_name='Gender')), | 32 | ('gender', models.CharField(choices=[('M', 'Male'), ('F', 'Female')], max_length=1, verbose_name='Gender')), |
| 33 | - ('image', models.ImageField(blank=True, upload_to='users/', verbose_name='Image')), | ||
| 34 | - ('birth_date', models.DateField(null=True, verbose_name='Birth Date')), | 33 | + ('image', models.ImageField(blank=True, null=True, upload_to='users/', verbose_name='Image')), |
| 34 | + ('birth_date', models.DateField(verbose_name='Birth Date')), | ||
| 35 | ('phone', models.CharField(blank=True, max_length=30, verbose_name='Phone')), | 35 | ('phone', models.CharField(blank=True, max_length=30, verbose_name='Phone')), |
| 36 | - ('cpf', models.CharField(blank=True, max_length=15, verbose_name='Cpf')), | 36 | + ('cpf', models.CharField(max_length=15, verbose_name='Cpf')), |
| 37 | ('type_profile', models.IntegerField(blank=True, choices=[(1, 'Professor'), (2, 'Student')], default=2, null=True, verbose_name='Type')), | 37 | ('type_profile', models.IntegerField(blank=True, choices=[(1, 'Professor'), (2, 'Student')], default=2, null=True, verbose_name='Type')), |
| 38 | ('titration', models.CharField(blank=True, max_length=50, null=True, verbose_name='Titration')), | 38 | ('titration', models.CharField(blank=True, max_length=50, null=True, verbose_name='Titration')), |
| 39 | ('year_titration', models.CharField(blank=True, max_length=4, null=True, verbose_name='Year of titration')), | 39 | ('year_titration', models.CharField(blank=True, max_length=4, null=True, verbose_name='Year of titration')), |
| @@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
| 1 | +# -*- coding: utf-8 -*- | ||
| 2 | +# Generated by Django 1.10 on 2016-11-15 22:41 | ||
| 3 | +from __future__ import unicode_literals | ||
| 4 | + | ||
| 5 | +from django.db import migrations, models | ||
| 6 | + | ||
| 7 | + | ||
| 8 | +class Migration(migrations.Migration): | ||
| 9 | + | ||
| 10 | + dependencies = [ | ||
| 11 | + ('users', '0001_initial'), | ||
| 12 | + ] | ||
| 13 | + | ||
| 14 | + operations = [ | ||
| 15 | + migrations.AlterField( | ||
| 16 | + model_name='user', | ||
| 17 | + name='birth_date', | ||
| 18 | + field=models.DateField(null=True, verbose_name='Birth Date'), | ||
| 19 | + ), | ||
| 20 | + ] |
users/models.py
| @@ -16,14 +16,14 @@ class User(AbstractBaseUser, PermissionsMixin): | @@ -16,14 +16,14 @@ class User(AbstractBaseUser, PermissionsMixin): | ||
| 16 | ) | 16 | ) |
| 17 | ], help_text = _('A short name that will be used to identify you in the platform and to access it')) | 17 | ], help_text = _('A short name that will be used to identify you in the platform and to access it')) |
| 18 | email = models.EmailField(_('Mail'), unique = True) | 18 | email = models.EmailField(_('Mail'), unique = True) |
| 19 | - name = models.CharField(_('Name'), max_length = 100, blank = True) | 19 | + name = models.CharField(_('Name'), max_length = 100) |
| 20 | city = models.CharField(_('City'), max_length = 90, blank = True) | 20 | city = models.CharField(_('City'), max_length = 90, blank = True) |
| 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'), null=True, blank = True, upload_to = 'users/') |
| 24 | birth_date = models.DateField(_('Birth Date'), null=True) | 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) |
| 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) |
| 28 | titration = models.CharField(_('Titration'), max_length = 50, blank = True, null = True) | 28 | titration = models.CharField(_('Titration'), max_length = 50, blank = True, null = True) |
| 29 | year_titration = models.CharField(_('Year of titration'), max_length = 4, blank = True, null = True) | 29 | year_titration = models.CharField(_('Year of titration'), max_length = 4, blank = True, null = True) |
| @@ -56,4 +56,4 @@ class User(AbstractBaseUser, PermissionsMixin): | @@ -56,4 +56,4 @@ class User(AbstractBaseUser, PermissionsMixin): | ||
| 56 | if self.image and hasattr(self.image, 'url'): | 56 | if self.image and hasattr(self.image, 'url'): |
| 57 | return self.image.url | 57 | return self.image.url |
| 58 | else: | 58 | else: |
| 59 | - return static('img/no_image.jpg') | ||
| 60 | \ No newline at end of file | 59 | \ No newline at end of file |
| 60 | + return static('img/no_image.jpg') |