Compare commits
2 Commits
02b81016b8
...
28eac94312
Author | SHA1 | Date |
---|---|---|
Yohann D'ANELLO | 28eac94312 | |
Yohann D'ANELLO | e2d4a80dba |
|
@ -13,7 +13,13 @@ class Command(BaseCommand):
|
||||||
default=stdin,
|
default=stdin,
|
||||||
help="Vinyle to be imported.")
|
help="Vinyle to be imported.")
|
||||||
|
|
||||||
|
parser.add_argument('--rpm',
|
||||||
|
type=int,
|
||||||
|
default=45,
|
||||||
|
help="RPM of the imported vinyles.")
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
|
rpm = options["rpm"]
|
||||||
file = options["input"]
|
file = options["input"]
|
||||||
vinyles = []
|
vinyles = []
|
||||||
for line in file:
|
for line in file:
|
||||||
|
@ -35,6 +41,7 @@ class Command(BaseCommand):
|
||||||
vinyle, created = Vinyle.objects.get_or_create(
|
vinyle, created = Vinyle.objects.get_or_create(
|
||||||
title=title,
|
title=title,
|
||||||
side_identifier=side,
|
side_identifier=side,
|
||||||
|
rp=rpm,
|
||||||
)
|
)
|
||||||
vinyle.authors.set(authors)
|
vinyle.authors.set(authors)
|
||||||
vinyle.save()
|
vinyle.save()
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 2.2.10 on 2020-05-23 12:20
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('media', '0033_futuremedia_type'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='vinyle',
|
||||||
|
name='rpm',
|
||||||
|
field=models.PositiveIntegerField(choices=[(33, '33 RPM'), (45, '45 RPM')], default=45, verbose_name='rounds per minute'),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
]
|
|
@ -218,6 +218,14 @@ class Vinyle(models.Model):
|
||||||
max_length=255,
|
max_length=255,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
rpm = models.PositiveIntegerField(
|
||||||
|
verbose_name=_('rounds per minute'),
|
||||||
|
choices=[
|
||||||
|
(33, _('33 RPM')),
|
||||||
|
(45, _('45 RPM')),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
authors = models.ManyToManyField(
|
authors = models.ManyToManyField(
|
||||||
'Auteur',
|
'Auteur',
|
||||||
verbose_name=_('authors'),
|
verbose_name=_('authors'),
|
||||||
|
|
Loading…
Reference in New Issue