diff --git a/sigi/apps/diagnosticos/admin.py b/sigi/apps/diagnosticos/admin.py index 3f7b070..02a5064 100644 --- a/sigi/apps/diagnosticos/admin.py +++ b/sigi/apps/diagnosticos/admin.py @@ -56,7 +56,7 @@ class DiagnosticoAdmin(BaseEntityAdmin): date_hierarchy = 'data_questionario' actions = [alterar_status_publicacao, alterar_status_draft] inlines = (EquipeInline, AnexosInline) - list_display = ('casa_legislativa', 'data_questionario', 'status') + list_display = ('casa_legislativa', 'data_questionario', 'responsavel', 'status') raw_id_fields = ('casa_legislativa', 'responsavel') eav_fieldsets = [ diff --git a/sigi/apps/diagnosticos/urls.py b/sigi/apps/diagnosticos/urls.py index 4cb3ae6..6f40dda 100644 --- a/sigi/apps/diagnosticos/urls.py +++ b/sigi/apps/diagnosticos/urls.py @@ -1,10 +1,20 @@ # -*- coding: utf8 -*- from django.conf.urls.defaults import patterns, url +LOGOUT_REDIRECT_URL = '/mobile/diagnosticos/login' + urlpatterns = patterns('', # Lista de Diagnósticos url(r'^$', 'sigi.apps.diagnosticos.views.lista', name='lista_diagnosticos'), + # Login do Diagnóstico + url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': + 'diagnosticos/diagnosticos_login.html'}, name='login'), + + # Logout do Diagnóstico + url(r'^logout/$', 'django.contrib.auth.views.logout', + {'next_page': LOGOUT_REDIRECT_URL}, name='logout'), + # Lista de Categorias url(r'^(?P\d+)/categorias/$', 'sigi.apps.diagnosticos.views.categorias', name='lista_categorias'), diff --git a/sigi/apps/diagnosticos/views.py b/sigi/apps/diagnosticos/views.py index 4233a6b..563d6c3 100644 --- a/sigi/apps/diagnosticos/views.py +++ b/sigi/apps/diagnosticos/views.py @@ -14,7 +14,8 @@ def lista(request): # TODO Implementar pesquisa de diagnosticos, em que esses registros # devem ser criado pelo servidor logado. - diagnosticos = Diagnostico.objects.filter(status=False) + diagnosticos = Diagnostico.objects.filter(status=False).filter( + responsavel=request.user.get_profile()) context = RequestContext(request, {'diagnosticos': diagnosticos}) return render_to_response('diagnosticos/diagnosticos_list.html', context) @@ -44,11 +45,13 @@ def categoria_detalhes(request, id_diagnostico, id_categoria): return render_to_response('mobile/404.html', {}) if request.POST: - form = DiagnosticoMobileForm(request.POST, instance=diagnostico, category=id_categoria) + form = DiagnosticoMobileForm(request.POST, + instance=diagnostico, category=id_categoria) if form.is_valid(): - form.save() + form.save() else: - form = DiagnosticoMobileForm(instance=diagnostico, category=id_categoria) + form = DiagnosticoMobileForm(instance=diagnostico, + category=id_categoria) context = RequestContext(request, {'form': form, 'categoria': categoria, 'diagnostico': diagnostico}) diff --git a/sigi/apps/servidores/admin.py b/sigi/apps/servidores/admin.py index 4c9e5a5..4f8faf7 100644 --- a/sigi/apps/servidores/admin.py +++ b/sigi/apps/servidores/admin.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- from django.contrib import admin +from django.contrib.auth.forms import UserCreationForm from django.contrib.contenttypes import generic from sigi.apps.servidores.models import Servidor, Funcao, Licenca, Ferias from sigi.apps.contatos.models import Endereco, Telefone diff --git a/sigi/settings.py b/sigi/settings.py index e35ffff..a34f0b3 100644 --- a/sigi/settings.py +++ b/sigi/settings.py @@ -98,6 +98,9 @@ AUTH_LDAP_MIRROR_GROUPS = True AUTH_LDAP_CACHE_GROUPS = True AUTH_LDAP_GROUP_CACHE_TIMEOUT = 3600 +# Django Auth Configurations +AUTH_PROFILE_MODULE = 'servidores.Servidor' + # Keep ModelBackend around for per-user permissions and maybe a local superuser. AUTHENTICATION_BACKENDS = ( 'django_auth_ldap.backend.LDAPBackend', diff --git a/sigi/templates/diagnosticos/diagnosticos_list.html b/sigi/templates/diagnosticos/diagnosticos_list.html index 0f63dc9..3a50171 100644 --- a/sigi/templates/diagnosticos/diagnosticos_list.html +++ b/sigi/templates/diagnosticos/diagnosticos_list.html @@ -2,7 +2,7 @@ {% block cabecalho %}

Diagnósticos

- Sair + Sair {% endblock cabecalho %} {% block corpo %} @@ -13,7 +13,7 @@

{{ diagnostico.casa_legislativa.nome }}

Data: {{ diagnostico.data_questionario|date:"d/m/Y" }}

-

Responsável: Nenhum Ainda

+

Responsável: {{ diagnostico.responsavel.nome_completo }}

{% endfor %} diff --git a/sigi/templates/diagnosticos/diagnosticos_login.html b/sigi/templates/diagnosticos/diagnosticos_login.html index e69de29..db17e70 100644 --- a/sigi/templates/diagnosticos/diagnosticos_login.html +++ b/sigi/templates/diagnosticos/diagnosticos_login.html @@ -0,0 +1,44 @@ + + + + + + SIGI - Login de Acesso + + + + + +
+ Interlegis +
+ {% if form.errors %} +
+

Erro ao logar

+ +

Verifique se seu login e senha foram preenchidos corretamente.

+
+ {% endif %} + +
+
+
+ + +
+
+ + +
+ + +
+
+ +