1
0
mirror of https://github.com/Damillora/Altessimo synced 2024-11-24 14:47:33 +00:00
Altessimo/songs/models.py
2020-12-17 15:12:26 +07:00

32 lines
1.2 KiB
Python

from django.db import models
# Create your models here.
class Song(models.Model):
branch = models.ForeignKey("categories.Branch", on_delete=models.PROTECT)
title = models.CharField(max_length=255)
romanized_title = models.CharField(max_length=255,blank=True)
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)
class Meta:
ordering = [ '-branch__acronym','romanized_title','title' ]
def __str__(self):
return "["+self.branch.acronym+"] "+self.title
class OutsideSong(models.Model):
title = models.CharField(max_length=255)
artist = models.CharField(max_length=255,blank=True)
origin = models.CharField(max_length=255)
url = models.URLField(max_length=255)
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