From: Michael Tremer Date: Sun, 19 Apr 2015 11:36:47 +0000 (+0200) Subject: nopaste: Add view counter X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bfbf061b3394944cb6d3f401eb4d849563cb9bb5;p=ipfire.org.git nopaste: Add view counter --- diff --git a/templates/nopaste/view.html b/templates/nopaste/view.html index 08d90925..8b949396 100644 --- a/templates/nopaste/view.html +++ b/templates/nopaste/view.html @@ -26,6 +26,9 @@
{{ _("Created") }}
{{ locale.format_date(entry.time_created) }}
+
{{ _("Views") }}
+
{{ entry.views }}
+
{{ _("Expires") }}
{% if entry.time_expires %} diff --git a/webapp/backend/nopaste.py b/webapp/backend/nopaste.py index 4f877330..15609609 100644 --- a/webapp/backend/nopaste.py +++ b/webapp/backend/nopaste.py @@ -42,7 +42,7 @@ class Nopaste(Object): return res def _update_lastseen(self, uuid): - self.db.execute("UPDATE nopaste SET time_lastseen = NOW() \ + self.db.execute("UPDATE nopaste SET time_lastseen = NOW(), views = views + 1 \ WHERE uuid = %s", uuid) def _cleanup_database(self):