art sorting by index for main and by date

This commit is contained in:
aj 2019-03-02 14:58:24 +00:00
parent 7d8b2ebf03
commit eb3adc740d
2 changed files with 10 additions and 6 deletions

View File

@ -13,14 +13,12 @@ def getTagDicts():
except google.cloud.exceptions.NotFound:
return 'no such document'
dicts = []
for tag in tags:
dicts.append(tag.to_dict())
dicts = list(map(lambda x: x.to_dict(), tags))
for artdict in dicts:
artdict['splash'] = artdict['splash'].get().to_dict()
return dicts
return sorted(dicts, key=lambda k: k['index'])
def getPopulatedTagDict(name):
@ -31,7 +29,8 @@ def getPopulatedTagDict(name):
image_list = []
for image in tag_dicts['art']:
image_list.append(image.get().to_dict())
tag_dicts['images'] = image_list
tag_dicts['images'] = sorted(image_list, key = lambda k: k['date'], reverse = True)
return tag_dicts

View File

@ -3,6 +3,8 @@ from jinja2 import TemplateNotFound
from google.cloud import firestore
fs = firestore.Client()
urlprefix = 'music'
music_print = Blueprint('music', __name__, template_folder='templates')
@ -10,4 +12,7 @@ music_print = Blueprint('music', __name__, template_folder='templates')
@music_print.route('/')
def root():
fmkey = fs.document('key/fm').get().to_dict()['clientid']
return render_template('music/index.html')