Exemple #1
0
class Book(models.Model):
    name = models.CharField(max_length=50)
    synopsis = models.CharField(max_length=255)
    book_type = models.CharField(max_length=15,
                                 null=True,
                                 choices=BOOK_CHOICES)
    pages = models.IntegerField(null=True)
    date_created = models.DateField(auto_now=True)
    author = models.ManyToManyField(foreign_key="Author")

    class Meta:
        ordering = ["-name"]
        unique_together = ["name", "synopsis"]
Exemple #2
0
class Developer(models.Model):
    name = models.CharField(max_length=50, unique=True)
    age = models.IntegerField(default=25)
    org = models.ManyToManyField(foreign_key='Organization')
Exemple #3
0
class Author(models.Model):
    na = models.PkField(db_column='uid')
    name = models.CharField(max_length=50, unique=True)
    email = models.EmailField(max_length=100, null=True)
    age = models.IntegerField()
    publisher = models.ManyToManyField(foreign_key='Publisher')
Exemple #4
0
class Author(models.Model):
    na = models.AutoField(db_column="uid")
    name = models.CharField(max_length=50, unique=True, db_index=True)
    email = models.EmailField(max_length=100, null=True, db_index=True)
    age = models.IntegerField()
    publisher = models.ManyToManyField(foreign_key="Publisher")