def __init__(self, *args, **kwargs): super(DocumentoAdministrativoFilterSet, self).__init__(*args, **kwargs) local_atual = 'tramitacaoadministrativo__unidade_tramitacao_destino' self.filters['tipo'].label = 'Tipo de Documento' self.filters['protocolo__numero'].label = 'Núm. Protocolo' self.filters['tramitacaoadministrativo__status'].label = 'Situação' self.filters[local_atual].label = 'Localização Atual' row1 = to_row([ ('tipo', 8), ('o', 4), ]) row2 = to_row([('numero', 2), ('ano', 2), ('protocolo__numero', 2), ('numero_externo', 2), ('data', 4)]) row3 = to_row([('interessado', 6), ('assunto', 6)]) row4 = to_row([ ('tramitacao', 2), ('tramitacaoadministrativo__status', 5), ('tramitacaoadministrativo__unidade_tramitacao_destino', 5), ]) self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Pesquisar Documento'), row1, row2, row3, row4, form_actions(label='Pesquisar')))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) instance = self.initial['instance'] if instance: self.instance = instance.first() self.fields['observacao'].initial = self.instance.observacao row1 = to_row([('observacao', 12)]) actions = [ HTML('<a href="{{ view.cancel_url }}"' ' class="btn btn-warning">Cancelar Leitura</a>') ] self.helper = SaplFormHelper() self.helper.form_method = 'POST' self.helper.layout = Layout( Fieldset( _('Leitura de Matéria'), HTML(''' <b>Matéria:</b> {{materia}}<br> <b>Ementa:</b> {{materia.ementa}} <br> '''), row1, form_actions(more=actions), ))
def __init__(self, *args, **kwargs): super(MateriaLegislativaFilterSet, self).__init__(*args, **kwargs) self.filters['tipo'].label = 'Tipo de Matéria' self.filters['autoria__autor__tipo'].label = 'Tipo de Autor' # self.filters['autoria__autor__partido'].label = 'Partido do Autor' self.filters['relatoria__parlamentar_id'].label = 'Relatoria' row1 = to_row([('tramitacao__status', 12)]) row2 = to_row([('tipo', 12)]) row3 = to_row([('numero', 4), ('ano', 4), ('numero_protocolo', 4)]) row4 = to_row([('data_apresentacao', 6), ('data_publicacao', 6)]) row5 = to_row([('autoria__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)]) row6 = to_row([ ('autoria__autor__tipo', 6), # ('autoria__autor__partido', 6) ]) row7 = to_row([('relatoria__parlamentar_id', 6), ('local_origem_externa', 6)]) row8 = to_row([('em_tramitacao', 6), ('o', 6)]) row9 = to_row([('ementa', 12)]) self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Pesquisa de Matéria'), row1, row2, row3, HTML(autor_label), HTML(autor_modal), row4, row5, row6, row7, row8, row9, form_actions(label='Pesquisar')))
def __init__(self, *args, **kwargs): super(ProtocoloFilterSet, self).__init__(*args, **kwargs) self.filters['timestamp'].label = 'Data (Inicial - Final)' row1 = to_row([('numero', 4), ('ano', 4), ('timestamp', 4)]) row2 = to_row([('tipo_documento', 4), ('tipo_protocolo', 4), ('tipo_materia', 4)]) row3 = to_row([('interessado', 6), ('assunto_ementa', 6)]) row4 = to_row([('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)]) row5 = to_row([('tipo_processo', 6), ('o', 6)]) self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Pesquisar Protocolo'), row1, row2, row3, row5, HTML(autor_label), HTML(autor_modal), row4, form_actions(label='Pesquisar')))
def __init__(self, *args, **kwargs): row1 = to_row([('username', 4)]) self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_('Votante'), row1, form_actions(label='Salvar'))) super(VotanteForm, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): layout_form = Fieldset( VinculoDocDiarioOficial._meta.verbose_name, Row( to_column(('content_type', 3)), to_column(('tipo', 3)), to_column(('numero', 2)), to_column(('ano', 2)), to_column(('pagina', 2)), to_column(('diario', 0)), ), Alert('', css_class="doc_selected hidden alert-info", dismiss=False), ) self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout(layout_form) super().__init__(*args, **kwargs) content_types = ContentType.objects.get_for_models( *models_with_gr_for_model(VinculoDocDiarioOficial)) self.fields['content_type'].choices = [ (ct.pk, ct) for k, ct in content_types.items() ] # Ordena por id self.fields['content_type'].choices.sort(key=lambda x: x[0])
def __init__(self, *args, **kwargs): row1 = to_row([('email', 12)]) self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_('Acompanhamento de Documento por e-mail'), row1, form_actions(label='Cadastrar'))) super(AcompanhamentoDocumentoForm, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): super(DesvincularMateriaForm, self).__init__(*args, **kwargs) row1 = to_row([('numero', 4), ('ano', 4), ('tipo', 4)]) self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_('Identificação da Matéria'), row1, HTML(" "), form_actions(label='Desvincular')))
def __init__(self, *args, **kwargs): super(FichaSelecionaAdmForm, self).__init__(*args, **kwargs) row1 = to_row([('documento', 12)]) self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(('Selecione a ficha que deseja imprimir'), row1, form_actions(label='Gerar Impresso')))
def __init__(self, *args, **kwargs): super(FichaPesquisaAdmForm, self).__init__(*args, **kwargs) row1 = to_row([('tipo_documento', 6), ('data_inicial', 3), ('data_final', 3)]) self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(('Formulário de Ficha'), row1, form_actions(label='Pesquisar')))
def __init__(self, *args, **kwargs): row1 = to_row([('arquivo', 4)]) row2 = to_row([('assunto', 12)]) self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout( Fieldset(_('Identificação Básica'), row1, row2)) super(AnexoAudienciaPublicaForm, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) row1 = to_row([('parlamentar', 6), ('legislatura', 3), ('data_expedicao_diploma', 3)]) self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset('Vincular Parlamentar', row1, form_actions(label='Vincular')))
def __init__(self, *args, **kwargs): super(ParlamentarFilterSet, self).__init__(*args, **kwargs) row0 = to_row([('nome_parlamentar', 12)]) self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Pesquisa de Parlamentar'), row0, form_actions(label='Pesquisar')))
def __init__(self, *args, **kwargs): row1 = to_row([('numero', 6), ('ano', 6)]) row2 = to_row([('justificativa_anulacao', 12)]) self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_('Identificação do Protocolo'), row1, row2, HTML(" "), form_actions(label='Anular'))) super(AnularProcoloAdmForm, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): row1 = to_row([('tipo_materia', 4), ('numero_paginas', 2), ('tipo_autor', 3), ('autor', 3)]) row2 = to_row([ (InlineRadios('vincular_materia'), 3), ('numero_materia', 2), ('ano_materia', 2), (Div(), 1), (InlineRadios('data_hora_manual'), 4), ]) row3 = to_row([ (Div(), 2), (Alert(""" Usuário: <strong>{}</strong> - {}<br> IP: <strong>{}</strong> - {}<br> """.format( kwargs['initial']['user_data_hora_manual'], Protocolo._meta.get_field('user_data_hora_manual').help_text, kwargs['initial']['ip_data_hora_manual'], Protocolo._meta.get_field('ip_data_hora_manual').help_text, ), dismiss=False, css_class='alert-info'), 6), ('data', 2), ('hora', 2), ]) row4 = to_row([('assunto_ementa', 12)]) row5 = to_row([('observacao', 12)]) row6 = to_row([('numero', 12)]) fieldset = Fieldset( _('Protocolo com data e hora informados manualmente'), row3, css_id='protocolo_data_hora_manual') config = AppConfig.objects.first() if not config.protocolo_manual: row3 = to_row([(HTML(" "), 12)]) fieldset = row3 self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_('Identificação da Matéria'), row1, row2), fieldset, row4, row5, HTML(" "), Fieldset( _('Número do Protocolo (Apenas se quiser que a numeração comece' ' a partir do número a ser informado)'), row6, HTML(" "), form_actions(label=_('Protocolar Matéria')))) super(ProtocoloMateriaForm, self).__init__(*args, **kwargs) if not config.protocolo_manual: self.fields['data_hora_manual'].widget = forms.HiddenInput()
def __init__(self, *args, **kwargs): self.user_session = kwargs.pop('user_session', None) row_pwd = to_row([('email', 4), ('first_name', 3), ('last_name', 3), ('is_active', 2), ('new_password1', 4), ('new_password2', 4), (FieldWithButtons( 'token', StrictButton('Renovar', id="renovar-token", css_class="btn-outline-primary")), 4), ('areatrabalho', 6), ('autor', 6), ('groups', 12), ('user_permissions', 12)]) self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout(row_pwd) super(CmjUserAdminForm, self).__init__(*args, **kwargs) if self.instance.pk: self.fields['token'].initial = self.instance.auth_token.key oper_at = self.instance.operadorareatrabalho_set.first() if oper_at: self.fields['areatrabalho'].initial = oper_at.areatrabalho.id oper_aut = self.instance.operadorautor_set.first() if oper_aut: self.fields['autor'].initial = oper_aut.autor.id self.fields['autor'].choices = [('', '----------')] + [ (a.id, '{} - {}'.format(a, a.tipo)) for a in Autor.objects.all().order_by('nome') ] self.fields['groups'].widget = forms.CheckboxSelectMultiple() self.fields['groups'].choices = [ (g.id, g) for g in self.instance.groups.all().order_by('name') ] + [(g.id, g) for g in Group.objects.exclude( user=self.instance).order_by('name')] self.fields[ 'user_permissions'].widget = forms.CheckboxSelectMultiple() self.fields['user_permissions'].choices = [ (p.id, p) for p in self.instance.user_permissions.all().order_by( 'content_type__app_label', 'content_type__model', 'codename') ] + [(p.id, p) for p in Permission.objects.exclude( user=self.instance).order_by('content_type__app_label', 'content_type__model', 'codename') ]
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) row1 = to_row([('tipo_norma', 6), ('data_inicial', 3), ('data_final', 3)]) row2 = to_row([('titulo', 12)]) self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset('Índice de Normas', row1, row2, form_actions(label='Pesquisar')))
def __init__(self, *args, **kwargs): super(AutoriaNormaForm, self).__init__(*args, **kwargs) row1 = to_row([('tipo_autor', 4), ('autor', 4), ('primeiro_autor', 4)]) self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_('Autoria'), row1, 'data_relativa', form_actions(label='Salvar'))) if not kwargs['instance']: self.fields['autor'].choices = []
def __init__(self, *args, **kwargs): super(SessaoPlenariaFilterSet, self).__init__(*args, **kwargs) # pré-popula o campo do formulário com o ano corrente self.form.fields['data_inicio__year'].initial = timezone.now().year row1 = to_row([('data_inicio__year', 3), ('data_inicio__month', 3), ('data_inicio__day', 3), ('tipo', 3)]) self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(self.titulo, row1, form_actions(label='Pesquisar')))
def __init__(self, *args, **kwargs): super(NormaFilterSet, self).__init__(*args, **kwargs) row1 = to_row([('tipo', 4), ('numero', 4), ('ano', 4)]) row2 = to_row([('ementa', 6), ('assuntos', 6)]) row3 = to_row([('data', 6), ('data_publicacao', 6)]) row4 = to_row([('data_vigencia', 12)]) row5 = to_row([('o', 4), ('indexacao', 4), ('apelido', 4)]) self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_('Pesquisa de Norma'), row1, row2, row3, row4, row5, form_actions(label='Pesquisar')))
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) row1 = to_row([ ('nome_lista', 6), ('cronometro', 6), ]) row2 = to_row([('tipo_lista', 6)]) actions = [ HTML('<a href="{{ view.cancel_url }}"' ' class="btn btn-dark">Cancelar</a>') ] self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_('Vincular Cronômetro à Lista de Discussão'), row1, row2, HTML(" "), form_actions(more=actions)))
def __init__(self, *args, **kwargs): super(PautaReuniaoFilterSet, self).__init__(*args, **kwargs) self.filters['materia__tipo'].label = "Tipo da Matéria" self.filters['materia__ano'].label = "Ano da Matéria" self.filters['materia__numero'].label = "Número da Matéria" self.filters[ 'materia__data_apresentacao'].label = "Data (Inicial - Final)" row1 = to_row([('materia__tipo', 4), ('materia__ano', 4), ('materia__numero', 4)]) row2 = to_row([('materia__data_apresentacao', 12)]) self.form.helper = SaplFormHelper() self.form.helper.form_method = "GET" self.form.helper.layout = Layout( Fieldset(_("Pesquisa de Matérias"), row1, row2, form_actions(label="Pesquisar")))
def __init__(self, *args, **kwargs): row1 = to_row([('tipo_de_retirada', 5), ('parlamentar', 4), ('data', 3)]) row2 = to_row([('ordem', 6), ('expediente', 6)]) row3 = to_row([('observacao', 12)]) self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout( Fieldset(_('Retirada de Pauta'), row1, row2, row3)) q = Q(sessao_plenaria=kwargs['initial']['sessao_plenaria']) ordens = OrdemDia.objects.filter(q) expedientes = ExpedienteMateria.objects.filter(q) retiradas_ordem = [ r.ordem for r in RetiradaPauta.objects.filter(q, ordem__in=ordens) ] retiradas_expediente = [ r.expediente for r in RetiradaPauta.objects.filter(q, expediente__in=expedientes) ] setOrdem = set(ordens) - set(retiradas_ordem) setExpediente = set(expedientes) - set(retiradas_expediente) super(RetiradaPautaForm, self).__init__(*args, **kwargs) if self.instance.pk: setOrdem = set(ordens) setExpediente = set(expedientes) presencas = SessaoPlenariaPresenca.objects.filter(q).order_by( 'parlamentar__nome_parlamentar') presentes = [p.parlamentar for p in presencas] self.fields['expediente'].choices = [(None, "------------")] + [ (e.id, e.materia) for e in setExpediente ] self.fields['ordem'].choices = [(None, "------------")] + [ (o.id, o.materia) for o in setOrdem ] self.fields['parlamentar'].choices = [(None, "------------")] + [ (p.id, p) for p in presentes ]
def __init__(self, *args, **kwargs): row1 = to_row([('parlamentar', 12)]) row2 = to_row([('data', 6), ('hora', 6)]) row3 = to_row([('upload_anexo', 6)]) row4 = to_row([('tipo_ausencia', 12)]) row5 = to_row([('ausencia', 12)]) row6 = to_row([('materias_do_expediente', 12)]) row7 = to_row([('materias_da_ordem_do_dia', 12)]) row8 = to_row([('observacao', 12)]) self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout( Fieldset(_('Justificativa de Ausência'), row1, row2, row3, row4, row5, row6, row7, row8)) q = Q(sessao_plenaria=kwargs['initial']['sessao_plenaria']) ordens = OrdemDia.objects.filter(q) expedientes = ExpedienteMateria.objects.filter(q) legislatura = kwargs['initial']['sessao_plenaria'].legislatura mandato = Mandato.objects.filter( legislatura=legislatura).order_by('parlamentar__nome_parlamentar') parlamentares = [m.parlamentar for m in mandato] super(JustificativaAusenciaForm, self).__init__(*args, **kwargs) presencas = SessaoPlenariaPresenca.objects.filter(q).order_by( 'parlamentar__nome_parlamentar') presencas_ordem = PresencaOrdemDia.objects.filter(q).order_by( 'parlamentar__nome_parlamentar') presentes = [p.parlamentar for p in presencas] presentes_ordem = [p.parlamentar for p in presencas_ordem] presentes_ambos = set(presentes).intersection(set(presentes_ordem)) setFinal = set(parlamentares) - presentes_ambos self.fields['materias_do_expediente'].choices = [(e.id, e.materia) for e in expedientes] self.fields['materias_da_ordem_do_dia'].choices = [(o.id, o.materia) for o in ordens] self.fields['parlamentar'].choices = [("0", "------------") ] + [(p.id, p) for p in setFinal]
def __init__(self, *args, **kwargs): super(ResumoOrdenacaoForm, self).__init__(*args, **kwargs) row1 = to_row([('primeiro', 12)]) row2 = to_row([('segundo', 12)]) row3 = to_row([('terceiro', 12)]) row4 = to_row([('quarto', 12)]) row5 = to_row([('quinto', 12)]) row6 = to_row([('sexto', 12)]) row7 = to_row([('setimo', 12)]) row8 = to_row([('oitavo', 12)]) row9 = to_row([('nono', 12)]) row10 = to_row([('decimo', 12)]) row11 = to_row([('decimo_primeiro', 12)]) row12 = to_row([('decimo_segundo', 12)]) row13 = to_row([('decimo_terceiro', 12)]) self.helper = SaplFormHelper() self.helper.layout = Layout( Fieldset(_(''), row1, row2, row3, row4, row5, row6, row7, row8, row9, row10, row11, row12, row13, form_actions(label='Atualizar')))
def __init__(self, *args, **kwargs): super(NormaFilterSet, self).__init__(*args, **kwargs) row1 = to_row([('tipo', 4), ('numero', 4), ('ano', 4)]) row2 = to_row([('ementa', 6), ('assuntos', 6)]) row3 = to_row([('data', 6), ('data_publicacao', 6)]) row4 = to_row([('data_vigencia', 10), ('vigencia', 2)]) row5 = to_row([('o', 4), ('indexacao', 4), ('apelido', 4)]) self.form.helper = SaplFormHelper() self.form.helper.form_method = 'GET' self.form.helper.layout = Layout( Fieldset(_( ''' Pesquisa de Norma<br> <small> <strong class="text-red">TODOS OS CAMPOS SÃO OPCIONAIS!</strong> </small> '''), row1, row2, row3, row4, row5, form_actions(label='Pesquisar')) )
def __init__(self, *args, **kwargs): row1 = to_row([('tipo', 6), ('numero', 3), ('ano', 3)]) row2 = to_row([('data', 4), ('numero_protocolo', 4), ('ano_protocolo', 4)]) row3 = to_row([('assunto', 12)]) row4 = to_row([('interessado', 7), ('tramitacao', 2), (InlineRadios('restrito'), 3)]) row5 = to_row([('texto_integral', 12)]) row6 = to_row([('numero_externo', 4), ('dias_prazo', 6), ('data_fim_prazo', 2)]) row7 = to_row([('observacao', 12)]) self.helper = SaplFormHelper() self.helper.layout = SaplFormLayout( Fieldset(_('Identificação Básica'), row1, row2, row3, row4, row5), Fieldset(_('Outras Informações'), row6, row7)) super(DocumentoAdministrativoForm, self).__init__(*args, **kwargs)