Browse Source

Restringe botoes da tela principal

pull/505/head
Eduardo Calil 9 years ago
committed by LeandroRoberto
parent
commit
71e04e8bab
  1. 4
      sapl/base/urls.py
  2. 11
      sapl/base/views.py
  3. 17
      sapl/parlamentares/views.py
  4. 8
      sapl/templates/base.html

4
sapl/base/urls.py

@ -4,13 +4,13 @@ from django.views.generic.base import TemplateView
from .apps import AppConfig
from .forms import LoginForm
from .views import CasaLegislativaCrud, HelpView
from .views import CasaLegislativaCrud, HelpView, SistemaView
app_name = AppConfig.name
urlpatterns = [
url(r'^sistema/', TemplateView.as_view(template_name='sistema.html')),
url(r'^sistema/', SistemaView.as_view()),
url(r'^ajuda/(?P<topic>\w+)$', HelpView.as_view(), name='help_topic'),
url(r'^ajuda/', TemplateView.as_view(template_name='ajuda/index.html'),
name='help_base'),

11
sapl/base/views.py

@ -44,3 +44,14 @@ class HelpView(PermissionRequiredMixin, TemplateView):
def get_template_names(self):
return ['ajuda/%s.html' % self.kwargs['topic']]
class SistemaView(PermissionRequiredMixin, TemplateView):
template_name = 'sistema.html'
permission_required = ''
def has_perm(self):
if self.request.user.is_superuser:
return True
else:
return False

17
sapl/parlamentares/views.py

@ -19,8 +19,6 @@ from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa,
NivelInstrucao, Parlamentar, Partido, SessaoLegislativa,
SituacaoMilitar, TipoAfastamento, TipoDependente)
DependenteCrud = MasterDetailCrud.build(Dependente, 'parlamentar', '')
class CargoMesaCrud(Crud):
model = CargoMesa
@ -78,6 +76,21 @@ class TipoMilitarCrud(Crud):
permission_required = permissoes_parlamentares()
class DependenteCrud(MasterDetailCrud):
model = Dependente
parent_field = 'parlamentar'
help_path = ''
class CreateView(PermissionRequiredMixin, MasterDetailCrud.CreateView):
permission_required = permissoes_parlamentares()
class UpdateView(PermissionRequiredMixin, MasterDetailCrud.UpdateView):
permission_required = permissoes_parlamentares()
class DeleteView(PermissionRequiredMixin, MasterDetailCrud.DeleteView):
permission_required = permissoes_parlamentares()
class MandatoCrud(MasterDetailCrud):
model = Mandato
parent_field = 'parlamentar'

8
sapl/templates/base.html

@ -46,13 +46,15 @@
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Institucional <span class="caret"></span></a>
<ul class="dropdown-menu">
{% if user.is_authenticated %}
<li class="nav__sub-item"><a class="nav__sub-link" href="{% url 'sapl.parlamentares:mesa_diretora' %}">Mesa Diretora</a></li>
{% endif %}
<li class="nav__sub-item"><a class="nav__sub-link" href="{% url 'sapl.comissoes:comissao_list' %}">Comissões</a></li>
<!-- <li class="nav__sub-item"><a class="nav__sub-link" href="#">Bancadas</a></li> -->
<li class="nav__sub-item"><a class="nav__sub-link" href="{% url 'sapl.parlamentares:parlamentar_list' %}">Parlamentares</a></li>
</ul>
</li>
{% if user.is_authenticated %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Protocolo <span class="caret"></span></a>
<ul class="dropdown-menu">
@ -63,6 +65,7 @@
{# <li class="nav__sub-item"><a class="nav__sub-link" href="{% url 'sapl.protocoloadm:proposicao' %}">Proposições</a></li> #}
</ul>
</li>
{% endif %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Atividade Legislativa <span class="caret"></span></a>
@ -86,7 +89,7 @@
<!-- <li class="nav__sub-item"><a class="nav__sub-link" href="#">Índice de Assuntos</a></li> -->
</ul>
</li>
{% if user.is_authenticated %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Sistema <span class="caret"></span></a>
<ul class="dropdown-menu">
@ -101,6 +104,7 @@
<li class="nav__sub-item"><a class="nav__sub-link" href="#">Troca de Senha</a></li> -->
</ul>
</li>
{% endif %}
</ul>
<ul class="nav navbar-nav navbar-right" id="autenticacao">

Loading…
Cancel
Save