mirror of
https://github.com/Damillora/Altessimo
synced 2024-10-31 21:17:32 +00:00
Complete backend
This commit is contained in:
parent
d91e794eec
commit
2af9f5e639
17
artists/migrations/0005_auto_20201216_0851.py
Normal file
17
artists/migrations/0005_auto_20201216_0851.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Generated by Django 3.1.4 on 2020-12-16 08:51
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('artists', '0004_auto_20201216_0724'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='artist',
|
||||||
|
options={'ordering': ['romanized_name', 'name']},
|
||||||
|
),
|
||||||
|
]
|
@ -13,7 +13,7 @@ class ArtistManager(models.Manager):
|
|||||||
def comma_to_qs(self, artists_str):
|
def comma_to_qs(self, artists_str):
|
||||||
final_ids = []
|
final_ids = []
|
||||||
for artist in artists_str.split(','):
|
for artist in artists_str.split(','):
|
||||||
obj, created = self.create_or_new(artist)
|
obj, created = self.create_or_new(strip(artist))
|
||||||
final_ids.append(obj.id)
|
final_ids.append(obj.id)
|
||||||
qs = self.get_queryset().filter(id__in=final_ids).distinct()
|
qs = self.get_queryset().filter(id__in=final_ids).distinct()
|
||||||
return qs
|
return qs
|
||||||
@ -28,5 +28,8 @@ class Artist(models.Model):
|
|||||||
|
|
||||||
objects = ArtistManager()
|
objects = ArtistManager()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = [ 'romanized_name','name' ]
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.romanized_name
|
return self.romanized_name
|
||||||
|
17
categories/migrations/0005_auto_20201216_0851.py
Normal file
17
categories/migrations/0005_auto_20201216_0851.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Generated by Django 3.1.4 on 2020-12-16 08:51
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('categories', '0004_auto_20201216_0724'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='category',
|
||||||
|
options={'ordering': ['name'], 'verbose_name_plural': 'Categories'},
|
||||||
|
),
|
||||||
|
]
|
@ -24,6 +24,7 @@ class Category(models.Model):
|
|||||||
objects = CategoryManager()
|
objects = CategoryManager()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
ordering = [ 'name' ]
|
||||||
verbose_name_plural = "Categories"
|
verbose_name_plural = "Categories"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
37
songs/migrations/0002_auto_20201216_0730.py
Normal file
37
songs/migrations/0002_auto_20201216_0730.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# Generated by Django 3.1.4 on 2020-12-16 07:30
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('songs', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='outsidesong',
|
||||||
|
name='romanized_title',
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='outsidesong',
|
||||||
|
name='artist',
|
||||||
|
field=models.CharField(blank=True, max_length=255),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='outsidesong',
|
||||||
|
name='origin',
|
||||||
|
field=models.CharField(blank=True, max_length=255),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='outsidesong',
|
||||||
|
name='title',
|
||||||
|
field=models.CharField(blank=True, max_length=255),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='outsidesong',
|
||||||
|
name='url',
|
||||||
|
field=models.URLField(blank=True, max_length=255),
|
||||||
|
),
|
||||||
|
]
|
27
songs/migrations/0003_auto_20201216_0736.py
Normal file
27
songs/migrations/0003_auto_20201216_0736.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Generated by Django 3.1.4 on 2020-12-16 07:36
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('songs', '0002_auto_20201216_0730'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Branch',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.CharField(blank=True, max_length=255)),
|
||||||
|
('acronym', models.CharField(blank=True, max_length=20)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='song',
|
||||||
|
name='branch',
|
||||||
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='songs.branch'),
|
||||||
|
),
|
||||||
|
]
|
17
songs/migrations/0004_remove_song_lyricist.py
Normal file
17
songs/migrations/0004_remove_song_lyricist.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Generated by Django 3.1.4 on 2020-12-16 08:00
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('songs', '0003_auto_20201216_0736'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='song',
|
||||||
|
name='lyricist',
|
||||||
|
),
|
||||||
|
]
|
20
songs/migrations/0005_auto_20201216_0838.py
Normal file
20
songs/migrations/0005_auto_20201216_0838.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Generated by Django 3.1.4 on 2020-12-16 08:38
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('songs', '0004_remove_song_lyricist'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='song',
|
||||||
|
name='branch',
|
||||||
|
field=models.ForeignKey(blank=True, default=1, on_delete=django.db.models.deletion.PROTECT, to='songs.branch'),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
]
|
23
songs/migrations/0006_auto_20201216_0840.py
Normal file
23
songs/migrations/0006_auto_20201216_0840.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 3.1.4 on 2020-12-16 08:40
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('songs', '0005_auto_20201216_0838'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='song',
|
||||||
|
name='romanized_title',
|
||||||
|
field=models.CharField(blank=True, max_length=255),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='song',
|
||||||
|
name='title',
|
||||||
|
field=models.CharField(blank=True, max_length=255),
|
||||||
|
),
|
||||||
|
]
|
19
songs/migrations/0007_song_lyricist.py
Normal file
19
songs/migrations/0007_song_lyricist.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Generated by Django 3.1.4 on 2020-12-16 08:42
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('artists', '0004_auto_20201216_0724'),
|
||||||
|
('songs', '0006_auto_20201216_0840'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='song',
|
||||||
|
name='lyricist',
|
||||||
|
field=models.ManyToManyField(blank=True, related_name='written_songs', to='artists.Artist'),
|
||||||
|
),
|
||||||
|
]
|
21
songs/migrations/0008_auto_20201216_0851.py
Normal file
21
songs/migrations/0008_auto_20201216_0851.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Generated by Django 3.1.4 on 2020-12-16 08:51
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('songs', '0007_song_lyricist'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='outsidesong',
|
||||||
|
options={'ordering': ['composer', 'title']},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='song',
|
||||||
|
options={'ordering': ['romanized_title', 'title']},
|
||||||
|
),
|
||||||
|
]
|
@ -1,17 +1,37 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
class Branch(models.Model):
|
||||||
|
name = models.CharField(max_length=255,blank=True)
|
||||||
|
acronym = models.CharField(max_length=20,blank=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name+" ["+self.acronym+"]"
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
class Song(models.Model):
|
class Song(models.Model):
|
||||||
title = models.CharField(max_length=255)
|
branch = models.ForeignKey("Branch", blank=True, on_delete=models.PROTECT)
|
||||||
romanized_title = models.CharField(max_length=255)
|
title = models.CharField(max_length=255,blank=True)
|
||||||
|
romanized_title = models.CharField(max_length=255,blank=True)
|
||||||
lyricist = models.ManyToManyField("artists.Artist", blank=True, related_name="written_songs")
|
lyricist = models.ManyToManyField("artists.Artist", blank=True, related_name="written_songs")
|
||||||
composer = models.ManyToManyField("artists.Artist", blank=True, related_name="composed_songs")
|
composer = models.ManyToManyField("artists.Artist", blank=True, related_name="composed_songs")
|
||||||
arranger = models.ManyToManyField("artists.Artist", blank=True, related_name="arranged_songs")
|
arranger = models.ManyToManyField("artists.Artist", blank=True, related_name="arranged_songs")
|
||||||
impression = models.TextField(blank=True)
|
impression = models.TextField(blank=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = [ 'romanized_title','title' ]
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return "["+self.branch.acronym+"] "+self.title
|
||||||
|
|
||||||
class OutsideSong(models.Model):
|
class OutsideSong(models.Model):
|
||||||
title = models.CharField(max_length=255)
|
title = models.CharField(max_length=255,blank=True)
|
||||||
romanized_title = models.CharField(max_length=255)
|
artist = models.CharField(max_length=255,blank=True)
|
||||||
origin = models.CharField(max_length=255)
|
origin = models.CharField(max_length=255,blank=True)
|
||||||
url = models.URLField(max_length=255)
|
url = models.URLField(max_length=255,blank=True)
|
||||||
composer = models.ForeignKey("artists.Artist", blank=True, on_delete=models.CASCADE)
|
composer = models.ForeignKey("artists.Artist", blank=True, on_delete=models.CASCADE)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = [ 'composer','title' ]
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return "["+self.composer.romanized_name+"] "+self.title
|
||||||
|
Loading…
Reference in New Issue
Block a user