|
@ -11,8 +11,8 @@ from sapl.crud.base import (RP_CHANGE, RP_DETAIL, RP_LIST, Crud, CrudAux, |
|
|
from sapl.materia.models import Proposicao, Relatoria |
|
|
from sapl.materia.models import Proposicao, Relatoria |
|
|
from sapl.parlamentares.apps import AppConfig |
|
|
from sapl.parlamentares.apps import AppConfig |
|
|
|
|
|
|
|
|
from .forms import (FiliacaoForm, LegislaturaForm, ParlamentarCreateForm, |
|
|
from .forms import (FiliacaoForm, LegislaturaForm, LegislaturaCreateForm, |
|
|
ParlamentarForm) |
|
|
ParlamentarCreateForm, ParlamentarForm) |
|
|
from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa, |
|
|
from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa, |
|
|
Dependente, Filiacao, Frente, Legislatura, Mandato, |
|
|
Dependente, Filiacao, Frente, Legislatura, Mandato, |
|
|
NivelInstrucao, Parlamentar, Partido, SessaoLegislativa, |
|
|
NivelInstrucao, Parlamentar, Partido, SessaoLegislativa, |
|
@ -149,7 +149,18 @@ class LegislaturaCrud(CrudAux): |
|
|
model = Legislatura |
|
|
model = Legislatura |
|
|
help_path = 'tabelas_auxiliares#legislatura' |
|
|
help_path = 'tabelas_auxiliares#legislatura' |
|
|
|
|
|
|
|
|
class BaseMixin(CrudAux.BaseMixin): |
|
|
class CreateView(CrudAux.CreateView): |
|
|
|
|
|
form_class = LegislaturaCreateForm |
|
|
|
|
|
|
|
|
|
|
|
def get_initial(self): |
|
|
|
|
|
try: |
|
|
|
|
|
ultima_legislatura = Legislatura.objects.latest('numero') |
|
|
|
|
|
numero = ultima_legislatura.numero + 1 |
|
|
|
|
|
except Legislatura.DoesNotExist: |
|
|
|
|
|
numero = 1 |
|
|
|
|
|
return {'numero': numero} |
|
|
|
|
|
|
|
|
|
|
|
class UpdateView(CrudAux.UpdateView): |
|
|
form_class = LegislaturaForm |
|
|
form_class = LegislaturaForm |
|
|
|
|
|
|
|
|
|
|
|
|
|
|