我有一個南方的數據遷移,試圖根據其他模型中找到的數據創建新的對象。當試圖創建一個給定的「目標」模式,我不斷收到一個新的對象:南方數據遷移「實例」錯誤,當使用南方凍結orm
Cannot assign "<ContentType: ContentType object>": "Publishing.content_type" must be a "ContentType" instance.
看來,有一些錯誤時,經南凍ORM訪問,例如「實例」:
ContentType = orm['contenttypes.ContentType']
content_type_kwargs = {
'model': ContentModel._meta.module_name,
'app_label': ContentModel._meta.app_label, }
content_type = ContentType.objects.get(**content_type_kwargs)
# further down
publishing_kwargs = {
'site': Site.objects.get_current(),
'publishing_type': publishing_type,
'start': start,
'content_type': content_type,
'object_id': content_object.id, }
publishing = orm.Publishing(**publishing_kwargs) # Produces the error above
現在我已經多次驗證content_type
實際上是ContentType的一個實例 - 但不知何故,django並不這麼認爲。
- 實例的「凍結」,南部的orm版本與本地django版本有區別嗎?
- 這可能是什麼?
Daryl,我面臨同樣的問題goo.gl/I7Jj6您是否設法解決它?我現在試圖使用content_type&object_id在數據遷移中創建一個新實例,但得到上面發佈的確切錯誤。 – Chantz 2011-08-13 18:09:40