mirror of
https://github.com/fergalmoran/dss.git
synced 2025-12-22 09:38:18 +00:00
19 lines
600 B
Python
Executable File
19 lines
600 B
Python
Executable File
from django.core.management.base import NoArgsCommand
|
|
|
|
from spa.models import tracklist
|
|
from spa.models.mix import Mix
|
|
|
|
|
|
class Command(NoArgsCommand):
|
|
help = "Create tracklists for all mixes"
|
|
|
|
def handle_noargs(self, **options):
|
|
mixes = Mix.objects.all()
|
|
for mix in mixes:
|
|
lines = mix.description.strip().split('\n')
|
|
index = 0
|
|
for line in lines:
|
|
mix.tracklist.add(tracklist(index=index, description=line))
|
|
mix.save()
|
|
print "%d: %s" % (index, line)
|
|
index += 1 |