allow creating pages filtered by tags
authorAndrew Engelbrecht <sudoman@ninthfloor.org>
Mon, 6 Mar 2017 19:46:43 +0000 (14:46 -0500)
committerAndrew Engelbrecht <sudoman@ninthfloor.org>
Mon, 6 Mar 2017 19:46:43 +0000 (14:46 -0500)
mediagoblin_libreplanet/views.py

index 832ba14..1dac5be 100644 (file)
@@ -21,8 +21,13 @@ from mediagoblin.tools.pagination import Pagination
 from mediagoblin.tools.response import render_to_response
 from mediagoblin.decorators import uses_pagination
 
 from mediagoblin.tools.response import render_to_response
 from mediagoblin.decorators import uses_pagination
 
-def type_listing(media_type, title, request, page):
-    cursor = MediaEntry.query.\
+def type_listing(media_type, title, request, page, tag=None):
+    if (tag == None):
+        cursor = MediaEntry.query
+    else:
+        cursor = media_entries_for_tag_slug(request.db, tag)
+
+    cursor = cursor.\
              filter((MediaEntry.media_type == media_type)
                     & (MediaEntry.state == u'processed')).\
              order_by(MediaEntry.created.desc())
              filter((MediaEntry.media_type == media_type)
                     & (MediaEntry.state == u'processed')).\
              order_by(MediaEntry.created.desc())