+# encoding: utf-8
from django.db import models
+class Group(models.Model):
+ name = models.CharField(max_length = 80)
+ shortName = models.CharField(max_length = 50, blank = True)
+ website = models.CharField(max_length = 150, blank = True)
+
+ def __unicode__(self):
+ return self.name + (' (' + self.website + ')' if (self.website != '') else '')
+
class Artist(models.Model):
name = models.CharField(max_length = 80)
+ realName = models.CharField(max_length = 80, blank = True)
+ groups = models.ManyToManyField(Group)
def __unicode__(self):
- return name
+ return self.name
-class Group(models.Model):
+class Party(models.Model):
+ name = models.CharField(max_length = 80)
+ website = models.CharField(max_length = 150, blank = True)
+
+ def __unicode__(self):
+ return self.name
+
+class Compo(models.Model):
name = models.CharField(max_length = 80)
- website = models.CharField(max_length = 150)
+
+ def __unicode__(self):
+ return self.name;
+
+class Release(models.Model):
+ party = models.ForeignKey(Party)
+ year = models.IntegerField()
+ compo = models.ForeignKey(Compo)
+ place = models.IntegerField()
+ pouetId = models.IntegerField(blank = True)
+
+ def __unicode__(self):
+ return self.compo.__unicode__() + ' @ ' + self.party.__unicode__() + ' ' + '%d' % self.year
+
+class Track(models.Model):
+ name = models.CharField(max_length = 150)
artists = models.ManyToManyField(Artist)
+ remix = models.CharField(max_length = 80, blank = True)
+ remixArtists = models.ManyToManyField(Artist, related_name = 'remixTracks', blank = True)
+ releases = models.ManyToManyField(Release)
+ length = models.IntegerField()
+ soundcloudLink = models.CharField(max_length = 150, blank = True)
+
+ def __unicode__(self):
+ #return '%s – %s%s' % (' & '.join(self.artists), self.name, (('%s by %s' % (self.remix, ' & '.join(self.remixArtists) + ')')) if (self.remix != '') else ''))
+ return u'{1} – {0}'.format(self.name, ' & '.join(a.name for a in self.artists.all()))
+
+class File(models.Model):
+ track = models.ForeignKey(Track)
+ path = models.CharField(max_length = 150)
+ type = models.CharField(max_length = 50)
def __unicode__(self):
- return self.name + ' (' + self.website + ')'
+ return self.type + ' (' + self.path + ')'