我正在爲我的車庫商店開展業餘愛好項目。我被導向django-model-utils來滿足我的需求。 (我有串行數控機牀,串行機器具有兩個流動控制方法)Django多表繼承,Django-model-utils錯誤
我有一個父類SerialMachine的(定義地址,波特率,通用RS-232定義)
然後,我有它繼承HardwareFlowControlMachine模型從SerialMachine(定義CTS/DTR/etc)
所以當我把機器名稱放到一個表格(比如說機器001)時,我有一個函數來獲取機器設置。
def getMachineSettings(machine):
from src.apps.cnc.models import SerialMachine
machineSettings = SerialMachine.objects.get(machineName=machine).select_subclasses()
return machineSettings
我得到這個異常:
DatabaseError: no such column: cnc_hardwareflowcontrolmachine.serialmachine_ptr_id
現在的測試中,我只有一臺機器在SoftwareFlowControlMachine(沒有在硬件)
我想,也許HardwareFlowControlMachine至少需要一個對象不管是什麼原因。所以,當我去/管理/並嘗試將計算機加入到任何SoftwareFlowControlMachine或HardwareFlowControlMachine我得到這個異常:
HardwareFlowControlMachine:
DatabaseError at /admin/cnc/hardwareflowcontrolmachine/
no such column: cnc_hardwareflowcontrolmachine.serialmachine_ptr_id
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/cnc/hardwareflowcontrolmachine/
Django Version: 1.4
Exception Type: DatabaseError
Exception Value:
no such column: cnc_hardwareflowcontrolmachine.serialmachine_ptr_id
Exception Location: C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 337
Python Executable: C:\Python27\python.exe
Python Version: 2.7.2
SoftwareFlowControlMachine:
DatabaseError at /admin/cnc/softwareflowcontrolmachine/
no such column: cnc_softwareflowcontrolmachine.serialmachine_ptr_id
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/cnc/softwareflowcontrolmachine/
Django Version: 1.4
Exception Type: DatabaseError
Exception Value:
no such column: cnc_softwareflowcontrolmachine.serialmachine_ptr_id
Exception Location: C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 337
Python Executable: C:\Python27\python.exe
Python Version: 2.7.2
讓我知道如果我需要提供更多信息。我真的不知道我缺少的是什麼