|
|
@ -100,6 +100,7 @@ class AcompanhamentoMateriaForm(ModelForm): |
|
|
|
|
|
|
|
|
|
|
|
class DocumentoAcessorioForm(ModelForm): |
|
|
|
autor = forms.CharField(widget=forms.HiddenInput(), required=False) |
|
|
|
|
|
|
|
class Meta: |
|
|
|
model = DocumentoAcessorio |
|
|
@ -112,13 +113,29 @@ class DocumentoAcessorioForm(ModelForm): |
|
|
|
'data': forms.DateInput(attrs={'class': 'dateinput'}) |
|
|
|
} |
|
|
|
|
|
|
|
def clean_autor(self): |
|
|
|
autor_field = self.cleaned_data['autor'] |
|
|
|
try: |
|
|
|
int(autor_field) |
|
|
|
except ValueError: |
|
|
|
return autor_field |
|
|
|
else: |
|
|
|
if autor_field: |
|
|
|
return str(Autor.objects.get(id=autor_field)) |
|
|
|
|
|
|
|
def __init__(self, excluir=False, *args, **kwargs): |
|
|
|
|
|
|
|
row1 = crispy_layout_mixin.to_row( |
|
|
|
[('tipo', 4), ('nome', 4), ('data', 4)]) |
|
|
|
|
|
|
|
row2 = crispy_layout_mixin.to_row( |
|
|
|
[('autor', 12)]) |
|
|
|
[('autor', 0), |
|
|
|
(Button('pesquisar', |
|
|
|
'Pesquisar Autor', |
|
|
|
css_class='btn btn-primary btn-sm'), 2), |
|
|
|
(Button('limpar', |
|
|
|
'Limpar Autor', |
|
|
|
css_class='btn btn-primary btn-sm'), 10)]) |
|
|
|
|
|
|
|
row3 = crispy_layout_mixin.to_row( |
|
|
|
[('ementa', 12)]) |
|
|
@ -131,7 +148,10 @@ class DocumentoAcessorioForm(ModelForm): |
|
|
|
self.helper.layout = Layout( |
|
|
|
Fieldset( |
|
|
|
_('Incluir Documento Acessório'), |
|
|
|
row1, row2, row3, |
|
|
|
row1, |
|
|
|
HTML(sapl.utils.autor_label), |
|
|
|
HTML(sapl.utils.autor_modal), |
|
|
|
row2, row3, |
|
|
|
form_actions(more=more) |
|
|
|
) |
|
|
|
) |
|
|
|