Added indexed lists and link edition in tunes

This commit is contained in:
marc
2025-03-11 23:05:20 +01:00
parent efd26ce19d
commit a85efd0838
22 changed files with 498 additions and 137 deletions

View File

@@ -1,6 +1,7 @@
import datetime
import json
from folkugat_web.model import IndexedList
from folkugat_web.model import temes as model
@@ -27,9 +28,9 @@ def row_to_tema(row: tuple) -> model.Tema:
return model.Tema(
id=row[0],
title=row[1],
properties=list(map(model.Property.from_dict, json.loads(row[2]))),
links=list(map(model.Link.from_dict, json.loads(row[3]))),
lyrics=list(map(model.Lyrics.from_dict, json.loads(row[4]))),
properties=IndexedList(map(model.Property.from_dict, json.loads(row[2]))),
links=IndexedList(map(model.Link.from_dict, json.loads(row[3]))),
lyrics=IndexedList(map(model.Lyrics.from_dict, json.loads(row[4]))),
alternatives=json.loads(row[5]),
ngrams=cell_to_ngrams(row[6]),
modification_date=datetime.datetime.fromisoformat(row[7]),