Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 30th, 2012  |  syntax: None  |  size: 1.02 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. class Track(models.Model):
  2.     objects = TrackManager()
  3.     title = models.CharField(max_length=900)
  4.     artist = models.ForeignKey(Artist)
  5.     album = models.ForeignKey(Album, blank=True, null=True)
  6.     year = models.DateField()
  7.     genre = models.ForeignKey(Genre, blank=True, null=True)
  8.     # samples / sampled by
  9.     samplings = models.ManyToManyField('self', through='Samples', symmetrical=False, related_name='sampled_by',)
  10.     samples = models.ManyToManyField('self', through='Samples', symmetrical=False, related_name='sampled',)
  11.     # timestamps
  12.     created_at = models.DateTimeField(auto_now_add=True)
  13.     updated_at = models.DateTimeField(auto_now=True)
  14.  
  15.  
  16. class Samples(object):
  17.     objects = SamplesManager()
  18.     original_track = models.ForeignKey('Track', related_name='original_tracks')
  19.     sample_track = models.ForeignKey('Track', related_name='sample_tracks')
  20.     position = models.IntegerField()
  21.     # timestamps
  22.     created_at = models.DateTimeField(auto_now_add=True)
  23.     updated_at = models.DateTimeField(auto_now=True)