Browse Source

Merge pull request #377 from interlegis/352-Crud-Legislacao-Citada

Fix #352 crud legislacao citada
pull/437/head
Edward 9 years ago
parent
commit
076fa76a3a
  1. 3
      materia/urls.py
  2. 28
      materia/views.py

3
materia/urls.py

@ -27,7 +27,8 @@ urlpatterns = [
DespachoInicialCrud.get_urls() +
NumeracaoCrud.get_urls() +
LegislacaoCitadaCrud.get_urls() +
TramitacaoCrud.get_urls())),
TramitacaoCrud.get_urls() +
LegislacaoCitadaCrud.get_urls())),
# Integração com Compilação
url(r'^materia/(?P<pk>[0-9]+)/ta$',

28
materia/views.py

@ -151,6 +151,34 @@ class LegislacaoCitadaCrud(MasterDetailCrud):
return 'LegislacaoCitadaDetail'
class LegislacaoCitadaCrud(MasterDetailCrud):
model = LegislacaoCitada
parent_field = 'materia'
help_path = ''
class BaseMixin(MasterDetailCrud.BaseMixin):
list_field_names = ['norma', 'disposicoes']
class CreateView(MasterDetailCrud.CreateView):
form_class = LegislacaoCitadaForm
class UpdateView(MasterDetailCrud.UpdateView):
form_class = LegislacaoCitadaForm
def get_initial(self):
self.initial['tipo_norma'] = self.object.norma.tipo.id
self.initial['numero_norma'] = self.object.norma.numero
self.initial['ano_norma'] = self.object.norma.ano
return self.initial
class DetailView(MasterDetailCrud.DetailView):
@property
def layout_key(self):
return 'LegislacaoCitadaDetail'
class NumeracaoCrud(MasterDetailCrud):
model = Numeracao
parent_field = 'materia'

Loading…
Cancel
Save