@ -104,10 +104,10 @@ def proposicao_texto(request, pk):
if proposicao . texto_original :
if proposicao . texto_original :
if ( not proposicao . data_recebimento and
if ( not proposicao . data_recebimento and
not proposicao . autor . operadores . filter (
not proposicao . autor . operadores . filter (
id = request . user . id
id = request . user . id
) . exists ( )
) . exists ( )
) :
) :
logger . error ( " user= " + username + " . Usuário ( {} ) não tem permissão para acessar o texto original. "
logger . error ( " user= " + username + " . Usuário ( {} ) não tem permissão para acessar o texto original. "
. format ( request . user . id ) )
. format ( request . user . id ) )
messages . error ( request , _ (
messages . error ( request , _ (
@ -2385,39 +2385,42 @@ class MateriaAnexadaEmLoteView(PermissionRequiredMixin, FilterView):
return context
return context
qr = self . request . GET . copy ( )
qr = self . request . GET . copy ( )
context [ ' object_list ' ] = context [ ' object_list ' ] . order_by (
if not len ( qr ) :
' numero ' , ' -ano ' )
context [ ' object_list ' ] = [ ]
principal = MateriaLegislativa . objects . get ( pk = self . kwargs [ ' pk ' ] )
else :
not_list = [ self . kwargs [ ' pk ' ] ] + \
context [ ' object_list ' ] = context [ ' object_list ' ] . order_by (
[ m for m in principal . materia_principal_set . all (
' numero ' , ' -ano ' )
) . values_list ( ' materia_anexada_id ' , flat = True ) ]
principal = MateriaLegislativa . objects . get ( pk = self . kwargs [ ' pk ' ] )
context [ ' object_list ' ] = context [ ' object_list ' ] . exclude (
not_list = [ self . kwargs [ ' pk ' ] ] + \
pk__in = not_list )
[ m for m in principal . materia_principal_set . all (
) . values_list ( ' materia_anexada_id ' , flat = True ) ]
context [ ' temp_object_list ' ] = context [ ' object_list ' ]
context [ ' object_list ' ] = context [ ' object_list ' ] . exclude (
context [ ' object_list ' ] = [ ]
pk__in = not_list )
for obj in context [ ' temp_object_list ' ] :
materia_anexada = obj
context [ ' temp_object_list ' ] = context [ ' object_list ' ]
ciclico = False
context [ ' object_list ' ] = [ ]
anexadas_anexada = Anexada . objects . filter (
for obj in context [ ' temp_object_list ' ] :
materia_principal = materia_anexada
materia_anexada = obj
)
ciclico = False
anexadas_anexada = Anexada . objects . filter (
materia_principal = materia_anexada
)
while anexadas_anexada and not ciclico :
while anexadas_anexada and not ciclico :
anexadas = [ ]
anexadas = [ ]
for anexa in anexadas_anexada :
for anexa in anexadas_anexada :
if principal == anexa . materia_anexada :
if principal == anexa . materia_anexada :
ciclico = True
ciclico = True
else :
else :
for a in Anexada . objects . filter ( materia_principal = anexa . materia_anexada ) :
for a in Anexada . objects . filter ( materia_principal = anexa . materia_anexada ) :
anexadas . append ( a )
anexadas . append ( a )
anexadas_anexada = anexadas
anexadas_anexada = anexadas
if not ciclico :
if not ciclico :
context [ ' object_list ' ] . append ( obj )
context [ ' object_list ' ] . append ( obj )
context [ ' numero_res ' ] = len ( context [ ' object_list ' ] )
context [ ' numero_res ' ] = len ( context [ ' object_list ' ] )