]> git.ipfire.org Git - people/shoehn/ipfire.org.git/commitdiff
nopaste: Add view counter
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 19 Apr 2015 11:36:47 +0000 (13:36 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 19 Apr 2015 11:38:13 +0000 (13:38 +0200)
templates/nopaste/view.html
webapp/backend/nopaste.py

index 08d909256e3a5654695a5bc4dfba68ab2c54cf70..8b949396f08569304e179a838c86f08d7541e1f9 100644 (file)
@@ -26,6 +26,9 @@
                                <dt>{{ _("Created") }}</dt>
                                <dd>{{ locale.format_date(entry.time_created) }}</dd>
 
+                               <dt>{{ _("Views") }}</dt>
+                               <dd>{{ entry.views }}</dd>
+
                                <dt>{{ _("Expires") }}</dt>
                                <dd>
                                        {% if entry.time_expires %}
index 4f877330cf25fd9d3c248b94e0a1139054fe2b02..156096092947d1c74d94a3a2d680133cd38b0862 100644 (file)
@@ -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):