Browse Source

Ajusta ordenação em proposições não recebidas (#2124)

pull/2139/head
cristian-longhi 7 years ago
committed by Victor Fabre
parent
commit
d5d12c7c89
  1. 10
      sapl/base/templatetags/common_tags.py
  2. 6
      sapl/materia/views.py
  3. 41
      sapl/templates/materia/prop_pendentes_list.html

10
sapl/base/templatetags/common_tags.py

@ -63,6 +63,16 @@ def sort_by_keys(value, key):
return transformed return transformed
@register.filter
def paginacao_limite_inferior(pagina):
return (int(pagina) - 1) * 10
@register.filter
def paginacao_limite_superior(pagina):
return int(pagina) * 10
@register.filter @register.filter
def lookup(d, key): def lookup(d, key):
return d[key] if key in d else [] return d[key] if key in d else []

6
sapl/materia/views.py

@ -426,6 +426,10 @@ class ProposicaoPendente(PermissionRequiredMixin, ListView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(ProposicaoPendente, self).get_context_data(**kwargs) context = super(ProposicaoPendente, self).get_context_data(**kwargs)
context['object_list'] = Proposicao.objects.filter(
data_envio__isnull=False,
data_recebimento__isnull=True,
data_devolucao__isnull=True)
paginator = context['paginator'] paginator = context['paginator']
page_obj = context['page_obj'] page_obj = context['page_obj']
context['AppConfig'] = sapl.base.models.AppConfig.objects.all().last() context['AppConfig'] = sapl.base.models.AppConfig.objects.all().last()
@ -434,6 +438,8 @@ class ProposicaoPendente(PermissionRequiredMixin, ListView):
context['NO_ENTRIES_MSG'] = 'Nenhuma proposição pendente.' context['NO_ENTRIES_MSG'] = 'Nenhuma proposição pendente.'
context['subnav_template_name'] = 'materia/subnav_prop.yaml' context['subnav_template_name'] = 'materia/subnav_prop.yaml'
qr = self.request.GET.copy()
context['filter_url'] = ('&o=' + qr['o']) if 'o' in qr.keys() else ''
return context return context

41
sapl/templates/materia/prop_pendentes_list.html

@ -39,24 +39,33 @@
{% define object_list as list %} {% define object_list as list %}
{% endif %} {% endif %}
{% if 'page' in request.GET %}
{% define request.GET.page as pagina %}
{% else %}
{% define '1' as pagina %}
{% endif %}
{% for prop in list %} {% for prop in list %}
<tr>
<td> {% if forloop.counter > pagina|paginacao_limite_inferior and forloop.counter <= pagina|paginacao_limite_superior %}
<a href="{% url 'sapl.materia:proposicao_detail' prop.pk %}">{{ prop.data_envio|localtime|date:"d/m/Y H:i:s" }}</a> <tr>
</td> <td>
<td>{{ prop.tipo.descricao }}</td> <a href="{% url 'sapl.materia:proposicao_detail' prop.pk %}">{{ prop.data_envio|localtime|date:"d/m/Y H:i:s" }}</a>
<td>{{ prop.descricao }}</td> </td>
<td>{{ prop.autor }}</td> <td>{{ prop.tipo.descricao }}</td>
<td> <td>{{ prop.descricao }}</td>
{% if not AppConfig.receber_recibo_proposicao %} <td>{{ prop.autor }}</td>
{%if prop.hash_code %} <td>
<a href="{% url 'sapl.materia:proposicao-confirmar' prop.hash_code|strip_hash prop.pk %}">{{ prop.hash_code }}</a> {% if not AppConfig.receber_recibo_proposicao %}
{% else %} {%if prop.hash_code %}
{{ prop.hash_code }} <a href="{% url 'sapl.materia:proposicao-confirmar' prop.hash_code|strip_hash prop.pk %}">{{ prop.hash_code }}</a>
{% else %}
{{ prop.hash_code }}
{% endif %}
{% endif %} {% endif %}
{% endif %} </td>
</td> </tr>
</tr> {% endif %}
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>

Loading…
Cancel
Save