mirror of https://github.com/interlegis/sapl.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.1 KiB
35 lines
1.1 KiB
from django.contrib.auth.mixins import PermissionRequiredMixin
|
|
from django.views.generic.base import TemplateView
|
|
|
|
from sapl.crud.base import Crud, CrudBaseMixin, CrudCreateView, CrudUpdateView
|
|
|
|
from .forms import CasaLegislativaForm
|
|
from .models import CasaLegislativa
|
|
|
|
|
|
def get_casalegislativa():
|
|
return CasaLegislativa.objects.first()
|
|
|
|
|
|
class CasaLegislativaCrud(Crud):
|
|
model = CasaLegislativa
|
|
help_path = ''
|
|
|
|
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
|
|
permission_required = {'base.add_casalegislativa'}
|
|
list_field_names = ['codigo', 'nome', 'sigla']
|
|
|
|
class CreateView(PermissionRequiredMixin, CrudCreateView):
|
|
permission_required = {'base.add_casa_legislativa'}
|
|
form_class = CasaLegislativaForm
|
|
|
|
class UpdateView(PermissionRequiredMixin, CrudUpdateView):
|
|
permission_required = {'base.change_casalegislativa'}
|
|
form_class = CasaLegislativaForm
|
|
|
|
|
|
class HelpView(PermissionRequiredMixin, TemplateView):
|
|
# XXX treat non existing template as a 404!!!!
|
|
|
|
def get_template_names(self):
|
|
return ['ajuda/%s.html' % self.kwargs['topic']]
|
|
|