class Table_1(models.Model):
    id = models.PrimaryKey()
    char_1 = models.Char(max_length=200)
    varchar_1 = models.VarChar(max_length=200)
    date_1 = models.Date()
    datetime_1 = models.DateTime()
    fk_1 = models.ForeignKey(Table_2)
    mm_1 = models.ManyToMany(Table_3)
Exemple #2
0
class Choice(models.Model):
    id = models.PrimaryKey()
    question = models.ForeignKey(Question)
    choice_text = models.Char(max_length=200)
    votes = models.Integer()
Exemple #3
0
class Question(models.Model):
    id = models.PrimaryKey()
    question_text = models.Char(max_length=200)
    pub_date = models.DateTime()
 def test_create_sql(self):
     test_pk = models.PrimaryKey()
     test_pk.name = 'test'  # models sets it
     self.assertEqual('test INTEGER NOT NULL PRIMARY KEY',
                      test_pk.create_sql())
class Table_3(models.Model):
    id = models.PrimaryKey()