| 1 |
""" |
| 2 |
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 |
|
| 13 |
class Thing(models.Model): |
| 14 |
when = models.CharField(max_length=1, primary_key=True) |
| 15 |
join = models.CharField(max_length=1) |
| 16 |
like = models.CharField(max_length=1) |
| 17 |
drop = models.CharField(max_length=1) |
| 18 |
alter = models.CharField(max_length=1) |
| 19 |
having = models.CharField(max_length=1) |
| 20 |
where = models.DateField(max_length=1) |
| 21 |
has_hyphen = models.CharField(max_length=1, db_column="has-hyphen") |
| 22 |
|
| 23 |
class Meta: |
| 24 |
db_table = "select" |
| 25 |
|
| 26 |
def __str__(self): |
| 27 |
return self.when |