diff --git a/sigi/apps/home/templatetags/menu_conf.yaml b/sigi/apps/home/templatetags/menu_conf.yaml index 161947a..23ed5e2 100644 --- a/sigi/apps/home/templatetags/menu_conf.yaml +++ b/sigi/apps/home/templatetags/menu_conf.yaml @@ -123,3 +123,10 @@ main_menu: url: saberes/dashboard/cursos-sem-turoria/ - title: Cursos com Tutoria url: saberes/dashboard/cursos-com-turoria/ + - title: Atesto + url: '/' + children: + - title: Convênio + url: convenio + - title: Responsável + url: responsavel diff --git a/sigi/apps/solicitacoes/layouts.yaml b/sigi/apps/solicitacoes/layouts.yaml index cfbf36f..ef0757c 100644 --- a/sigi/apps/solicitacoes/layouts.yaml +++ b/sigi/apps/solicitacoes/layouts.yaml @@ -6,7 +6,6 @@ Sistema: Solicitacao: Solicitação: - - codigo - usuario - sistema - casa_legislativa diff --git a/sigi/apps/usuarios/forms.py b/sigi/apps/usuarios/forms.py index 47d528d..afe0797 100644 --- a/sigi/apps/usuarios/forms.py +++ b/sigi/apps/usuarios/forms.py @@ -5,7 +5,7 @@ from datetime import datetime from captcha.fields import CaptchaField from crispy_forms.helper import FormHelper -from crispy_forms.layout import Fieldset, Layout, Submit +from crispy_forms.layout import HTML, Fieldset, Layout, Submit from django import forms from django.contrib.auth.forms import (AuthenticationForm, PasswordResetForm, SetPasswordForm) @@ -25,6 +25,60 @@ from sigi.apps.crud.utils import YES_NO_CHOICES from .models import Telefone, Usuario +class ResponsavelForm(ModelForm): + responsavel = forms.TypedChoiceField( + widget=forms.Select(), + label=_(u'Responsavel?'), + choices=YES_NO_CHOICES) + + class Meta(object): + model = Usuario + fields = ['responsavel'] + + def __init__(self, *args, **kwargs): + super(ResponsavelForm, self).__init__(*args, **kwargs) + row1 = sigi.apps.crispy_layout_mixin.to_row([(u'responsavel', 12)]) + + self.helper = FormHelper() + self.helper.layout = Layout( + Fieldset(_(u'Atestar Responsável'), + HTML(u'''
+ Ao atestar a responsabilidade deste convênio você + estará assumindo responsabilidade por qualquer + problema que poderá ocorrer pela existência de dados + incorretos.
'''), + row1, + form_actions( + save_label='Atestar'))) + + +class ConveniadoForm(ModelForm): + conveniado = forms.TypedChoiceField( + widget=forms.Select(), + label=_(u'Conveniado?'), + choices=YES_NO_CHOICES) + + class Meta(object): + model = Usuario + fields = ['conveniado'] + + def __init__(self, *args, **kwargs): + super(ConveniadoForm, self).__init__(*args, **kwargs) + row1 = sigi.apps.crispy_layout_mixin.to_row([(u'conveniado', 12)]) + + self.helper = FormHelper() + self.helper.layout = Layout( + Fieldset(_(u'Atestar Conveniado'), + HTML(u'''+ Ao atestar o convênio deste usuário você estará + assumindo resonsabilidade por qualquer problema + que poderá ocorrer pela existência de dados + incorretos.
'''), + row1, + form_actions( + save_label='Atestar'))) + + class LoginForm(AuthenticationForm): username = forms.CharField( label=u"Username", max_length=30, diff --git a/sigi/apps/usuarios/migrations/0007_auto_20160628_1609.py b/sigi/apps/usuarios/migrations/0007_auto_20160628_1609.py new file mode 100644 index 0000000..65c2839 --- /dev/null +++ b/sigi/apps/usuarios/migrations/0007_auto_20160628_1609.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-06-28 16:09 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('usuarios', '0006_remove_usuario_search_text'), + ] + + operations = [ + migrations.RemoveField( + model_name='usuario', + name='habilitado', + ), + migrations.AlterField( + model_name='usuario', + name='conveniado', + field=models.BooleanField(default=False, verbose_name='Conveniado?'), + ), + migrations.AlterField( + model_name='usuario', + name='responsavel', + field=models.BooleanField(default=False, verbose_name='Rspons\xe1vel?'), + ), + ] diff --git a/sigi/apps/usuarios/migrations/0008_atesto.py b/sigi/apps/usuarios/migrations/0008_atesto.py new file mode 100644 index 0000000..f6abff9 --- /dev/null +++ b/sigi/apps/usuarios/migrations/0008_atesto.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-06-29 13:56 +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('usuarios', '0007_auto_20160628_1609'), + ] + + operations = [ + migrations.CreateModel( + name='Atesto', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('data', models.DateTimeField(default=django.utils.timezone.now)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + options={ + 'verbose_name': 'Atesto', + 'verbose_name_plural': 'Atestos', + }, + ), + ] diff --git a/sigi/apps/usuarios/migrations/0009_usuario_atesto_conveniado.py b/sigi/apps/usuarios/migrations/0009_usuario_atesto_conveniado.py new file mode 100644 index 0000000..433ebcf --- /dev/null +++ b/sigi/apps/usuarios/migrations/0009_usuario_atesto_conveniado.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-06-29 13:57 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('usuarios', '0008_atesto'), + ] + + operations = [ + migrations.AddField( + model_name='usuario', + name='atesto_conveniado', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='usuarios.Atesto'), + ), + ] diff --git a/sigi/apps/usuarios/migrations/0010_auto_20160629_1448.py b/sigi/apps/usuarios/migrations/0010_auto_20160629_1448.py new file mode 100644 index 0000000..4955547 --- /dev/null +++ b/sigi/apps/usuarios/migrations/0010_auto_20160629_1448.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.6 on 2016-06-29 14:48 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('usuarios', '0009_usuario_atesto_conveniado'), + ] + + operations = [ + migrations.CreateModel( + name='AtestoConvenio', + fields=[ + ('atesto_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='usuarios.Atesto')), + ], + bases=('usuarios.atesto',), + ), + migrations.CreateModel( + name='AtestoResponsavel', + fields=[ + ('atesto_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='usuarios.Atesto')), + ], + bases=('usuarios.atesto',), + ), + migrations.AlterField( + model_name='usuario', + name='atesto_conveniado', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='usuarios.AtestoConvenio'), + ), + migrations.AlterField( + model_name='usuario', + name='responsavel', + field=models.BooleanField(default=False, verbose_name='Respons\xe1vel?'), + ), + migrations.AddField( + model_name='usuario', + name='atesto_responsavel', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='usuarios.AtestoResponsavel'), + ), + ] diff --git a/sigi/apps/usuarios/models.py b/sigi/apps/usuarios/models.py index 024324e..95c0723 100644 --- a/sigi/apps/usuarios/models.py +++ b/sigi/apps/usuarios/models.py @@ -64,6 +64,23 @@ class ConfirmaEmail(models.Model): verbose_name_plural = _(u'Emails') +class Atesto(models.Model): + user = models.ForeignKey(User) + data = models.DateTimeField(default=timezone.now) + + class Meta(object): + verbose_name = _(u'Atesto') + verbose_name_plural = _(u'Atestos') + + +class AtestoResponsavel(Atesto): + pass + + +class AtestoConvenio(Atesto): + pass + + class Usuario(models.Model): u''' Usuário cadastrado via web @@ -89,11 +106,6 @@ class Usuario(models.Model): email = email = models.EmailField(unique=True, verbose_name=_(u'Email')) email_confirmado = models.BooleanField( default=False, verbose_name=_(u'Email confirmado?')) - habilitado = models.BooleanField( - default=False, - verbose_name=_(u'Habilitado?')) - conveniado = models.BooleanField(default=False) - responsavel = models.BooleanField(default=False) rg = models.CharField( max_length=9, null=True, @@ -121,6 +133,15 @@ class Usuario(models.Model): verbose_name=_(u'Casa Legislativa') ) + responsavel = models.BooleanField( + default=False, + verbose_name=_(u'Responsável?')) + conveniado = models.BooleanField( + default=False, + verbose_name=_(u'Conveniado?')) + atesto_conveniado = models.ForeignKey(AtestoConvenio, null=True) + atesto_responsavel = models.ForeignKey(AtestoResponsavel, null=True) + class Meta(object): verbose_name = _(u'Usuário') verbose_name_plural = _(u'Usuários') diff --git a/sigi/apps/usuarios/urls.py b/sigi/apps/usuarios/urls.py index d9be142..93dfdc2 100644 --- a/sigi/apps/usuarios/urls.py +++ b/sigi/apps/usuarios/urls.py @@ -9,15 +9,17 @@ from django.views.generic.base import TemplateView from sigi.apps.usuarios.forms import (LoginForm, RecuperacaoMudarSenhaForm, RecuperarSenhaEmailForm) -from sigi.apps.usuarios.views import (ConfirmarEmailView, HabilitarDetailView, +from sigi.apps.usuarios.views import (ConfirmarEmailView, ConveniadoListView, + ConveniadoView, HabilitarDetailView, HabilitarEditView, MudarSenhaView, + ResponsavelListView, ResponsavelView, UsuarioCrud) from .apps import AppConfig app_name = AppConfig.name -EMAIL_SEND_USER='atendimento@interlegis.leg.br' +EMAIL_SEND_USER = 'atendimento@interlegis.leg.br' recuperar_email = [ url(ur'^atendimento/recuperar/recuperar_senha/$', @@ -60,6 +62,17 @@ urlpatterns = recuperar_email + [ HabilitarEditView.as_view(), name=u'habilitar_edit'), url(ur'^atendimento/usuario/(?PDados da Casa Legislativa | +
---|
+ Casa: {{casa}} + CNJ: {{casa.cnpj}} + Município: {{casa.municipio}} + Email: {{casa.email}} + Cep: {{casa.cep}} + Página: {{casa.pagina_web}} + Telefone: {{casa.telefone}} + |
+
Não há nenhum usuário para ser verificado.
+ {% endif %} +{% endblock %} diff --git a/templates/usuarios/responsavel.html b/templates/usuarios/responsavel.html new file mode 100644 index 0000000..0c89ef4 --- /dev/null +++ b/templates/usuarios/responsavel.html @@ -0,0 +1,33 @@ +{% extends "admin/base_site.html" %} +{% load i18n crispy_forms_tags %} + +{% block content %} +Dados informado pelo Usuário | +Dados da Casa Legislativa | +
---|---|
+ Nome completo: {{usuario.nome_completo}} + Email: {{usuario.email}} + CPF: {{usuario.cpf}} + RG: {{usuario.rg}} + Cargo: {{usuario.cargo}} + Vinculo: {{usuario.vinculo}} + |
+
+ Casa: {{casa}} + CNJ: {{casa.cnpj}} + Município: {{casa.municipio}} + Email: {{casa.email}} + Cep: {{casa.cep}} + Página: {{casa.pagina_web}} + Telefone: {{casa.telefone}} + |
+
Não há nenhum usuário para ser verificado.
+ {% endif %} +{% endblock %}