Browse Source

Faz as permissoes de Casa Legislativa

pull/505/head
Eduardo Calil 9 years ago
committed by LeandroRoberto
parent
commit
8f5cb4998f
  1. 12
      sapl/base/views.py

12
sapl/base/views.py

@ -1,3 +1,4 @@
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
@ -17,13 +18,16 @@ class CasaLegislativaCrud(Crud):
model = CasaLegislativa model = CasaLegislativa
help_path = '' help_path = ''
class BaseMixin(CrudBaseMixin): class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = {'base.add_casalegislativa'}
list_field_names = ['codigo', 'nome', 'sigla'] list_field_names = ['codigo', 'nome', 'sigla']
class CreateView(CrudCreateView): class CreateView(PermissionRequiredMixin, CrudCreateView):
permission_required = {'base.add_casa_legislativa'}
form_class = CasaLegislativaForm form_class = CasaLegislativaForm
class UpdateView(CrudUpdateView): class UpdateView(PermissionRequiredMixin, CrudUpdateView):
permission_required = {'base.change_casalegislativa'}
form_class = CasaLegislativaForm form_class = CasaLegislativaForm
class DetailView(CrudDetailView): class DetailView(CrudDetailView):
@ -35,7 +39,7 @@ class CasaLegislativaCrud(Crud):
kwargs={'pk': self.kwargs['pk']})) kwargs={'pk': self.kwargs['pk']}))
class HelpView(TemplateView): class HelpView(PermissionRequiredMixin, TemplateView):
# XXX treat non existing template as a 404!!!! # XXX treat non existing template as a 404!!!!
def get_template_names(self): def get_template_names(self):

Loading…
Cancel
Save