1
0
mirror of https://github.com/Damillora/Altessimo synced 2024-10-31 21:17:32 +00:00
Altessimo/songs/models.py

32 lines
1.2 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
2020-12-15 21:32:20 +00:00
# Create your models here.
class Song(models.Model):
2020-12-16 17:36:29 +00:00
branch = models.ForeignKey("categories.Branch", on_delete=models.PROTECT)
2020-12-16 19:25:33 +00:00
title = models.CharField(max_length=255)
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 17:36:29 +00:00
title = models.CharField(max_length=255)
2020-12-16 08:51:48 +00:00
artist = models.CharField(max_length=255,blank=True)
2020-12-16 17:36:29 +00:00
origin = models.CharField(max_length=255)
url = models.URLField(max_length=255)
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