Browse Source

Add pagination for machine history results

self_pseudo_change
Jean-Romain Garnier 6 years ago
committed by klafyvel
parent
commit
01236373aa
  1. 1
      logs/templates/logs/machine_history.html
  2. 17
      logs/views.py

1
logs/templates/logs/machine_history.html

@ -66,6 +66,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr>
{% endfor %}
</table>
{% include 'pagination.html' with list=events %}
{% else %}
<h3>{% trans "No result" %}</h3>
{% endif %}

17
logs/views.py

@ -489,16 +489,19 @@ def stats_search_machine_history(request):
history_form = MachineHistoryForm(request.GET or None)
if history_form.is_valid():
history = MachineHistory()
events = history.get(
history_form.cleaned_data.get("q", ""),
history_form.cleaned_data
)
max_result = GeneralOption.get_cached_value("search_display_page")
re2o_paginator(request,
events,
max_result)
return render(
request,
"logs/machine_history.html",
{
"events":
history.get(
history_form.cleaned_data.get("q", ""),
history_form.cleaned_data
)
},
{ "events": events },
)
return render(request, "logs/search_machine_history.html", {"history_form": history_form})

Loading…
Cancel
Save