Skip to content

Instantly share code, notes, and snippets.

@natea
Created June 7, 2011 21:36
Show Gist options
  • Save natea/1013233 to your computer and use it in GitHub Desktop.
Save natea/1013233 to your computer and use it in GitHub Desktop.
Valentunes models.py
class Card(models.Model):
""" Card is a valentine's day card that contains the information
about who the card is from and who it's to, what the recipients
interests are and a personal note.
"""
user = models.ForeignKey(User)
recipient_name = models.CharField(max_length=200, blank=True)
recipient_email = models.EmailField(max_length=200, null=True, blank=True)
recipient_phone = models.CharField(max_length=200, blank=True)
intro_note = models.TextField(max_length=1000, blank=True)
interests = models.TextField(max_length=1000, blank=True)
create_date = models.DateTimeField(auto_now_add=True)
def __unicode__(self):
return u"%s"%("Card"+str(self.id)+" from " + " to " + self.recipient_name)
class Track(models.Model):
""" Track is a song that we've found on MusixMatch based on the recipients' interests."""
card = models.ManyToManyField(Card)
track_mbid = models.CharField(max_length=50)
track_name = models.CharField(max_length=200)
album_coverart_100x100 = models.URLField(max_length=200)
artist_name = models.CharField(max_length=200)
artist_mbid = models.CharField(max_length=200)
audio_url = models.URLField(max_length=640)
search_term = models.CharField(max_length=200)
def __unicode__(self):
return u"%s"%(self.artist_name+" - " + self.track_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment