diff --git a/main.py b/main.py index 28ee83c..11a53a3 100644 --- a/main.py +++ b/main.py @@ -19,16 +19,29 @@ def music(): @app.route('/art') def art(): art_collection = db.collection(u'art') + #art_tags_collection = db.collection(u'art_tags') try: - docs = art_collection.get() + pics = art_collection.get() + #tags = art_tags_collection.get() except google.cloud.exceptions.NotFound: return 'no such document' + + #categories = [] + #for tag in tags: + #taglist = { + #tag.to_dict()['name'] : [] + #} + #print(tag.to_dict()) + #categories.append(taglist) + #print(categories) + images = [] - for doc in docs: - image = doc.to_dict() - images.append(image) + for doc in pics: + #image = doc.to_dict() + images.append(doc.to_dict()) + #categories[categories.index(image['tag'])].append(image) return render_template('art.html', staticroot = staticbucketurl, images=images) diff --git a/templates/art.html b/templates/art.html index 923d51f..d767325 100644 --- a/templates/art.html +++ b/templates/art.html @@ -4,14 +4,21 @@ {% block title %}art{% endblock %} {% block content %} - - {% for image in images %} - {% if loop.index0 % 3 == 0 %}
{% endif %} + +{#{% for tag in tags %}#} + + {% for row in images|batch(3) %} +
+ {% for image in row %} + {#{% if loop.index0 % 3 == 0 %}
{% endif %}#}
{{ image.file_name  }}

{{ image.description }}

- {% if loop.index % 3 == 0 or loop.last %}
{% endif %} - + {#{% if loop.index % 3 == 0 or loop.last %}
{% endif %}#} + {% endfor %} +
{% endfor %} + +{#{% endfor %}#} {% endblock %}