# History
- async def get_history(self, limit=None):
+ async def get_history(self, before=None, limit=None):
"""
Fetches the history of this list
"""
response = await self._backend.dnsbl._fetch(
- "/lists/%s/history" % self.slug, args={ "limit" : limit },
+ "/lists/%s/history" % self.slug, args={ "before" : before, "limit" : limit },
)
return [History(self._backend, **data) for data in response]
{% block title %}{{ _("IPFire DNSBL") }} - {{ list }} - {{ _("History") }}{% end block %}
{% block container %}
+ {% import urllib.parse %}
+
<section class="hero is-dark">
<div class="hero-body">
<div class="container">
</div>
</section>
{% end %}
+
+ {# Pagination #}
+ <section class="section">
+ <div class="container">
+ <nav class="pagination" role="navigation" aria-label="pagination">
+ {# Find the oldest timestamp #}
+ {% set before = min(e.ts for e in history) %}
+
+ <a class="pagination-next"
+ href="/dnsbl/lists/{{ list.slug }}/history?before={{ urllib.parse.quote(before.isoformat()) }}">
+ {{ _("Older") }} »
+ </a>
+ </nav>
+ </div>
+ </section>
{% end block %}
raise tornado.web.HTTPError(404, "Could not find list '%s'" % slug)
# Fetch the history
- history = await list.get_history(limit=10)
+ history = await list.get_history(
+ before = self.get_argument("before", None),
+ limit = 10,
+ )
# Render the page
self.render("dnsbl/lists/history.html", list=list, history=history)