Exemplo n.º 1
0
class Skill(models.Model):
    dev = models.ForeignKey(foreign_key="Developer")
    name = models.CharField(max_length=64)
    specialization = models.ArrayField(null=True,
                                       value_type="text",
                                       db_index=True)
    notes = models.TextField(null=True)
Exemplo n.º 2
0
class Book(models.Model):
    name = models.CharField(max_length=50)
    content = models.CharField(max_length=255, choices=BOOK_CHOICES)
    date_created = models.DateField(auto_now=True)
    author = models.ForeignKey(foreign_key="Author", null=True)
    price = models.DecimalField(default=25)
    quantity = models.IntegerField(default=1)

    @staticmethod
    def its_a_2():
        return 2

    class Meta:
        table_name = "library"
        ordering = ["-id"]
        unique_together = ["name", "content"]
Exemplo n.º 3
0
class Book(models.Model):
    name = models.CharField(max_length=50)
    content = models.CharField(max_length=255, choices=BOOK_CHOICES)
    date_created = models.DateField(auto_now=True)
    author = models.ForeignKey(foreign_key='Author', null=True)
    price = models.DecimalField(default=25)
    quantity = models.IntegerField(default=1)

    def its_a_2(self):
        return 2

    class Meta():
        table_name = 'library'
        ordering = [
            '-id',
        ]
        unique_together = ['name', 'content']
Exemplo n.º 4
0
class Client(models.Model):
    name = models.CharField(max_length=10)
    dev = models.ForeignKey(foreign_key='Developer')
    appoinment = models.ForeignKey(foreign_key='Appointment', null=True)