Beispiel #1
0
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)
Beispiel #2
0
class Choice(models.Model):
    id = models.PrimaryKey()
    question = models.ForeignKey(Question)
    choice_text = models.Char(max_length=200)
    votes = models.Integer()
Beispiel #3
0
class Question(models.Model):
    id = models.PrimaryKey()
    question_text = models.Char(max_length=200)
    pub_date = models.DateTime()
Beispiel #4
0
 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())
Beispiel #5
0
class Table_3(models.Model):
    id = models.PrimaryKey()