art sorting by index for main and by date
This commit is contained in:
parent
7d8b2ebf03
commit
eb3adc740d
@ -13,14 +13,12 @@ def getTagDicts():
|
|||||||
except google.cloud.exceptions.NotFound:
|
except google.cloud.exceptions.NotFound:
|
||||||
return 'no such document'
|
return 'no such document'
|
||||||
|
|
||||||
dicts = []
|
dicts = list(map(lambda x: x.to_dict(), tags))
|
||||||
for tag in tags:
|
|
||||||
dicts.append(tag.to_dict())
|
|
||||||
|
|
||||||
for artdict in dicts:
|
for artdict in dicts:
|
||||||
artdict['splash'] = artdict['splash'].get().to_dict()
|
artdict['splash'] = artdict['splash'].get().to_dict()
|
||||||
|
|
||||||
return dicts
|
return sorted(dicts, key=lambda k: k['index'])
|
||||||
|
|
||||||
def getPopulatedTagDict(name):
|
def getPopulatedTagDict(name):
|
||||||
|
|
||||||
@ -31,7 +29,8 @@ def getPopulatedTagDict(name):
|
|||||||
image_list = []
|
image_list = []
|
||||||
for image in tag_dicts['art']:
|
for image in tag_dicts['art']:
|
||||||
image_list.append(image.get().to_dict())
|
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
|
return tag_dicts
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@ from jinja2 import TemplateNotFound
|
|||||||
|
|
||||||
from google.cloud import firestore
|
from google.cloud import firestore
|
||||||
|
|
||||||
|
fs = firestore.Client()
|
||||||
|
|
||||||
urlprefix = 'music'
|
urlprefix = 'music'
|
||||||
|
|
||||||
music_print = Blueprint('music', __name__, template_folder='templates')
|
music_print = Blueprint('music', __name__, template_folder='templates')
|
||||||
@ -10,4 +12,7 @@ music_print = Blueprint('music', __name__, template_folder='templates')
|
|||||||
|
|
||||||
@music_print.route('/')
|
@music_print.route('/')
|
||||||
def root():
|
def root():
|
||||||
|
fmkey = fs.document('key/fm').get().to_dict()['clientid']
|
||||||
|
|
||||||
|
|
||||||
return render_template('music/index.html')
|
return render_template('music/index.html')
|
||||||
|
Loading…
Reference in New Issue
Block a user