1
0
mirror of https://github.com/Damillora/Altessimo synced 2024-11-22 05:57:31 +00:00
Altessimo/songs/models.py

38 lines
1.4 KiB
Python
Raw Normal View History

2020-12-15 21:32:20 +00:00
from django.db import models
2020-12-16 08:51:48 +00:00
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+"]"
2020-12-15 21:32:20 +00:00
# Create your models here.
class Song(models.Model):
2020-12-16 08:51:48 +00:00
branch = models.ForeignKey("Branch", blank=True, on_delete=models.PROTECT)
title = models.CharField(max_length=255,blank=True)
romanized_title = models.CharField(max_length=255,blank=True)
2020-12-15 21:32:20 +00:00
lyricist = models.ManyToManyField("artists.Artist", blank=True, related_name="written_songs")
composer = models.ManyToManyField("artists.Artist", blank=True, related_name="composed_songs")
arranger = models.ManyToManyField("artists.Artist", blank=True, related_name="arranged_songs")
impression = models.TextField(blank=True)
2020-12-16 08:51:48 +00:00
class Meta:
ordering = [ 'romanized_title','title' ]
def __str__(self):
return "["+self.branch.acronym+"] "+self.title
2020-12-15 21:32:20 +00:00
class OutsideSong(models.Model):
2020-12-16 08:51:48 +00:00
title = models.CharField(max_length=255,blank=True)
artist = models.CharField(max_length=255,blank=True)
origin = models.CharField(max_length=255,blank=True)
url = models.URLField(max_length=255,blank=True)
2020-12-15 21:32:20 +00:00
composer = models.ForeignKey("artists.Artist", blank=True, on_delete=models.CASCADE)
2020-12-16 08:51:48 +00:00
class Meta:
ordering = [ 'composer','title' ]
def __str__(self):
return "["+self.composer.romanized_name+"] "+self.title