Browse Source

Fix #3191 - Corrigindo erro em comissao (#3192)

pull/3197/head
Ulysses Lara 5 years ago
committed by GitHub
parent
commit
2d749379c1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      sapl/comissoes/forms.py

4
sapl/comissoes/forms.py

@ -10,6 +10,7 @@ from django.db import transaction
from django.db.models import Q from django.db.models import Q
from django.forms import ModelForm from django.forms import ModelForm
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from sapl.base.models import Autor, TipoAutor from sapl.base.models import Autor, TipoAutor
from sapl.comissoes.models import (Comissao, Composicao, from sapl.comissoes.models import (Comissao, Composicao,
@ -142,7 +143,6 @@ class ParticipacaoCreateForm(forms.ModelForm):
values_list('parlamentar', values_list('parlamentar',
flat=True flat=True
).distinct() ).distinct()
qs = Parlamentar.objects.filter(id__in=parlamentares).distinct().\ qs = Parlamentar.objects.filter(id__in=parlamentares).distinct().\
exclude(id__in=id_part) exclude(id__in=id_part)
eligible = self.verifica() eligible = self.verifica()
@ -184,7 +184,7 @@ class ParticipacaoCreateForm(forms.ModelForm):
def create_participacao(self): def create_participacao(self):
composicao = Composicao.objects.get(id=self.initial['parent_pk']) composicao = Composicao.objects.get(id=self.initial['parent_pk'])
data_inicio_comissao = composicao.periodo.data_inicio data_inicio_comissao = composicao.periodo.data_inicio
data_fim_comissao = composicao.periodo.data_fim data_fim_comissao = composicao.periodo.data_fim if composicao.periodo.data_fim else timezone.now()
q1 = Q(data_fim_mandato__isnull=False, q1 = Q(data_fim_mandato__isnull=False,
data_fim_mandato__gte=data_inicio_comissao) data_fim_mandato__gte=data_inicio_comissao)
q2 = Q(data_inicio_mandato__gte=data_inicio_comissao) \ q2 = Q(data_inicio_mandato__gte=data_inicio_comissao) \

Loading…
Cancel
Save