From 8dcf17a69f7713b9fde67a5ec88e5e394dd7fbee Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 11 May 2013 01:31:47 +0200 Subject: [PATCH] Add style to tracks. --- data/admin.py | 3 ++- data/models.py | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/data/admin.py b/data/admin.py index d957b22..5a3f9c3 100644 --- a/data/admin.py +++ b/data/admin.py @@ -18,10 +18,11 @@ class RemixArtistInline(admin.TabularInline): class TrackAdmin(admin.ModelAdmin): fieldsets = [ - (None, {'fields': ['name', 'length']}), + (None, {'fields': ['name', 'length', 'styles']}), ('Remix Information', {'fields': ['remix'], 'classes': ['collapse']}), ('Release Information', {'fields': ['releases']}), ] inlines = [TrackArtistInline, RemixArtistInline] +admin.site.register(Style) admin.site.register(Track, TrackAdmin) diff --git a/data/models.py b/data/models.py index 482e987..da15ab5 100644 --- a/data/models.py +++ b/data/models.py @@ -62,9 +62,16 @@ class RemixArtist(models.Model): class Meta: ordering = ['order'] +class Style(models.Model): + name = models.CharField(max_length = 80) + + def __unicode__(self): + return self.name + class Track(models.Model): name = models.CharField(max_length = 150) artists = models.ManyToManyField(Artist, through = TrackArtist) + styles = models.ManyToManyField(Style, blank = True) remix = models.CharField(max_length = 80, blank = True) remixArtists = models.ManyToManyField(Artist, through = RemixArtist, related_name = 'remixTracks') releases = models.ManyToManyField(Release) -- 2.7.4