equal
deleted
inserted
replaced
|
1 """ |
|
2 18. Using SQL reserved names |
|
3 |
|
4 Need to use a reserved SQL name as a column name or table name? Need to include |
|
5 a hyphen in a column or table name? No problem. Django quotes names |
|
6 appropriately behind the scenes, so your database won't complain about |
|
7 reserved-name usage. |
|
8 """ |
|
9 |
|
10 from django.db import models |
|
11 |
|
12 class Thing(models.Model): |
|
13 when = models.CharField(max_length=1, primary_key=True) |
|
14 join = models.CharField(max_length=1) |
|
15 like = models.CharField(max_length=1) |
|
16 drop = models.CharField(max_length=1) |
|
17 alter = models.CharField(max_length=1) |
|
18 having = models.CharField(max_length=1) |
|
19 where = models.DateField(max_length=1) |
|
20 has_hyphen = models.CharField(max_length=1, db_column='has-hyphen') |
|
21 class Meta: |
|
22 db_table = 'select' |
|
23 |
|
24 def __unicode__(self): |
|
25 return self.when |