Browse Source

Adicionar ordenação

pull/2826/head
João Rodrigues 7 years ago
parent
commit
9f89fe3481
  1. 12
      sapl/base/views.py
  2. 3
      sapl/templates/base/anexadas_ciclicas.html
  3. 4
      sapl/templates/base/anexados_ciclicos.html

12
sapl/base/views.py

@ -1084,13 +1084,13 @@ def anexados_ciclicos(ofMateriaLegislativa):
'materia_principal' 'materia_principal'
).annotate( ).annotate(
count=Count('materia_principal') count=Count('materia_principal')
).filter(count__gt=0).order_by('data_anexacao') ).filter(count__gt=0).order_by('-data_anexacao')
else: else:
principais = Anexado.objects.values( principais = Anexado.objects.values(
'documento_principal' 'documento_principal'
).annotate( ).annotate(
count=Count('documento_principal') count=Count('documento_principal')
).filter(count__gt=0).order_by('data_anexacao') ).filter(count__gt=0).order_by('-data_anexacao')
for principal in principais: for principal in principais:
anexados_total = [] anexados_total = []
@ -1098,11 +1098,11 @@ def anexados_ciclicos(ofMateriaLegislativa):
if ofMateriaLegislativa: if ofMateriaLegislativa:
anexados = Anexada.objects.filter( anexados = Anexada.objects.filter(
materia_principal=principal['materia_principal'] materia_principal=principal['materia_principal']
) ).order_by('-data_anexacao')
else: else:
anexados = Anexado.objects.filter( anexados = Anexado.objects.filter(
documento_principal=principal['documento_principal'] documento_principal=principal['documento_principal']
) ).order_by('-data_anexacao')
anexados_temp = list(anexados) anexados_temp = list(anexados)
while anexados_temp: while anexados_temp:
@ -1116,7 +1116,7 @@ def anexados_ciclicos(ofMateriaLegislativa):
) )
anexados_temp.extend(anexados_anexado) anexados_temp.extend(anexados_anexado)
else: else:
ciclicos.append((anexado.materia_principal, anexado.materia_anexada)) ciclicos.append((anexado.data_anexacao, anexado.materia_principal, anexado.materia_anexada))
else: else:
if anexado.documento_anexado not in anexados_total: if anexado.documento_anexado not in anexados_total:
if not principal['documento_principal'] == anexado.documento_anexado.pk: if not principal['documento_principal'] == anexado.documento_anexado.pk:
@ -1126,7 +1126,7 @@ def anexados_ciclicos(ofMateriaLegislativa):
) )
anexados_temp.extend(anexados_anexado) anexados_temp.extend(anexados_anexado)
else: else:
ciclicos.append((anexado.documento_principal, anexado.documento_anexado)) ciclicos.append((anexado.data_anexacao, anexado.documento_principal, anexado.documento_anexado))
return ciclicos return ciclicos

3
sapl/templates/base/anexadas_ciclicas.html

@ -15,8 +15,9 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for fim, inicio in anexadas_ciclicas %} {% for data, fim, inicio in anexadas_ciclicas %}
<tr> <tr>
<td>{{ data }}</td>
<td> <td>
<a href="{% url 'sapl.materia:materialegislativa_detail' fim.pk %}">{{ fim }}</a> <a href="{% url 'sapl.materia:materialegislativa_detail' fim.pk %}">{{ fim }}</a>
</td> </td>

4
sapl/templates/base/anexados_ciclicos.html

@ -10,13 +10,15 @@
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead> <thead>
<tr> <tr>
<th>Data Anexação</th>
<th>Documento Fim do Ciclo</th> <th>Documento Fim do Ciclo</th>
<th>Documento Início do Ciclo</th> <th>Documento Início do Ciclo</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for fim, inicio in anexados_ciclicos %} {% for data, fim, inicio in anexados_ciclicos %}
<tr> <tr>
<td>{{ data }}</td>
<td> <td>
<a href="{% url 'sapl.protocoloadm:documentoadministrativo_detail' fim.pk %}">{{ fim }}</a> <a href="{% url 'sapl.protocoloadm:documentoadministrativo_detail' fim.pk %}">{{ fim }}</a>
</td> </td>

Loading…
Cancel
Save