2
18. Using SQL reserved names
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
10
from django.db import models
11
from django.utils.encoding import python_2_unicode_compatible
14
@python_2_unicode_compatible
15
class Thing(models.Model):
16
when = models.CharField(max_length=1, primary_key=True)
17
join = models.CharField(max_length=1)
18
like = models.CharField(max_length=1)
19
drop = models.CharField(max_length=1)
20
alter = models.CharField(max_length=1)
21
having = models.CharField(max_length=1)
22
where = models.DateField(max_length=1)
23
has_hyphen = models.CharField(max_length=1, db_column='has-hyphen')