diff --git a/sapl/comissoes/forms.py b/sapl/comissoes/forms.py index 5aadad6b4..77523d26b 100644 --- a/sapl/comissoes/forms.py +++ b/sapl/comissoes/forms.py @@ -10,6 +10,7 @@ from django.db import transaction from django.db.models import Q from django.forms import ModelForm from django.utils.translation import ugettext_lazy as _ +from django.utils import timezone from sapl.base.models import Autor, TipoAutor from sapl.comissoes.models import (Comissao, Composicao, @@ -142,7 +143,6 @@ class ParticipacaoCreateForm(forms.ModelForm): values_list('parlamentar', flat=True ).distinct() - qs = Parlamentar.objects.filter(id__in=parlamentares).distinct().\ exclude(id__in=id_part) eligible = self.verifica() @@ -184,7 +184,7 @@ class ParticipacaoCreateForm(forms.ModelForm): def create_participacao(self): composicao = Composicao.objects.get(id=self.initial['parent_pk']) 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, data_fim_mandato__gte=data_inicio_comissao) q2 = Q(data_inicio_mandato__gte=data_inicio_comissao) \