admin.site.register(Party)
admin.site.register(Compo)
admin.site.register(Release)
-admin.site.register(Track)
admin.site.register(File)
+
+class TrackArtistInline(admin.TabularInline):
+ model = TrackArtist
+ extra = 1
+
+class RemixArtistInline(admin.TabularInline):
+ model = RemixArtist
+ extra = 1
+
+class TrackAdmin(admin.ModelAdmin):
+ fieldsets = [
+ (None, {'fields': ['name', 'length']}),
+ ('Remix Information', {'fields': ['remix'], 'classes': ['collapse']}),
+ ('Release Information', {'fields': ['releases']}),
+ ]
+ inlines = [TrackArtistInline, RemixArtistInline]
+
+admin.site.register(Track, TrackAdmin)
year = models.IntegerField()
compo = models.ForeignKey(Compo)
place = models.IntegerField()
- pouetId = models.IntegerField(blank = True)
+ pouetId = models.IntegerField(blank = True, null = True)
def __unicode__(self):
return self.compo.__unicode__() + ' @ ' + self.party.__unicode__() + ' ' + '%d' % self.year
+class TrackArtist(models.Model):
+ track = models.ForeignKey('Track')
+ artist = models.ForeignKey(Artist)
+ order = models.IntegerField()
+
+class RemixArtist(models.Model):
+ track = models.ForeignKey('Track')
+ artist = models.ForeignKey(Artist)
+ order = models.IntegerField()
+
class Track(models.Model):
name = models.CharField(max_length = 150)
- artists = models.ManyToManyField(Artist)
+ artists = models.ManyToManyField(Artist, through = TrackArtist)
remix = models.CharField(max_length = 80, blank = True)
- remixArtists = models.ManyToManyField(Artist, related_name = 'remixTracks', blank = True)
+ remixArtists = models.ManyToManyField(Artist, through = RemixArtist, related_name = 'remixTracks')
releases = models.ManyToManyField(Release)
length = models.IntegerField()
soundcloudLink = models.CharField(max_length = 150, blank = True)