SHARE
TWEET

Untitled

a guest Jan 12th, 2017 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class PerfumeBrand(models.Model):
  2.     class Meta:
  3.         verbose_name = "Marque de parfum"
  4.         verbose_name_plural = "Marques de parfum"
  5.  
  6.     name = models.CharField(max_length=32)
  7.  
  8.     def __str__(self):
  9.         return self.person.first_name + ' ' +  self.person.last_name.upper() + ': ' + self.name
  10.  
  11.  
  12. class Person(models.Model):
  13.     class Meta:
  14.         verbose_name = "Personne"
  15.         verbose_name_plural = "Personnes"
  16.  
  17.     first_name = models.CharField(max_length=32, )
  18.     last_name = models.CharField(max_length=32)
  19.     email = models.EmailField(unique=True)
  20.     # Here is the ManyToMany relation
  21.     perfume_brands = models.ManyToManyField(PerfumeBrand)
RAW Paste Data
Top