1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2025-06-21 12:38:23 +02:00

Import 45 RPM vinyles

This commit is contained in:
Yohann D'ANELLO
2020-05-24 17:47:37 +02:00
parent 44abcaf202
commit e63d8630cc
2 changed files with 16 additions and 4 deletions

View File

@ -34,14 +34,15 @@ class Command(BaseCommand):
continue
side = vinyle[0]
title = vinyle[1]
authors_str = vinyle[2].split('|')
title = vinyle[1 if rpm == 33 else 2]
authors_str = vinyle[2 if rpm == 33 else 1]\
.split('|' if rpm == 33 else ';')
authors = [Auteur.objects.get_or_create(name=author)[0]
for author in authors_str]
vinyle, created = Vinyle.objects.get_or_create(
title=title,
side_identifier=side,
rp=rpm,
rpm=rpm,
)
vinyle.authors.set(authors)
vinyle.save()