Django Book 翻译
菜单>:
TOC
返回
原文:
* If the database column name is a Python reserved word (such as ``'pass'`` , ``'class'`` , or ``'for'`` ), ``inspectdb`` will append ``'_field'`` to the attribute name. For example, if a table has a column ``'for'`` , the generated model will have a field ``'for_field'`` , with the ``db_column`` attribute set to ``'for'`` . ``inspectdb`` will insert the Python comment ``'Field renamed because it was a Python reserved word.'`` next to the field.
翻译:
假如資料庫的欄位名稱是Python的保留字(如 pass,class,for),那inspectdb會加上_field到這個性質名稱的後面。例如,假如一個表有一個欄位叫做for,這產生的模型就會有一個欄位叫做for_field,對應到db_column的性質是for,inspectdb將會填入Python註解,欄位被改名字了,因為這是Python的保留字。加上旁邊
备注:
译者: