Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
django oscar运行时错误:模型冲突_Django_Django Oscar - Fatal编程技术网

django oscar运行时错误:模型冲突

django oscar运行时错误:模型冲突,django,django-oscar,Django,Django Oscar,版本信息:Python2.7,Django1.9,OscarCommerce-Version=(1.3) 我正试图在目录应用程序中根据文档定制产品和少数其他型号 我已根据文档创建了分叉目录应用程序(到我的项目/分叉应用程序/目录),并在models.py中完成了此操作: from django.db import models from oscar.apps.catalogue.abstract_models import AbstractProduct class Product(Abstr

版本信息:Python2.7,Django1.9,OscarCommerce-Version=(1.3)

我正试图在目录应用程序中根据文档定制产品和少数其他型号

我已根据文档创建了分叉目录应用程序(到我的项目/分叉应用程序/目录),并在models.py中完成了此操作:

from django.db import models
from oscar.apps.catalogue.abstract_models import AbstractProduct

class Product(AbstractProduct):
    is_active = models.BooleanField(default=False)

from oscar.apps.catalogue.models import *
我已经在settings.py中的INSTALLED_APPS中包含了修改过的目录应用程序,作为get_core_APPS函数的参数,如文档中所述(因此我的本地应用程序正在替换奥斯卡的原始应用程序)

迁移也会从oscar.apps.catalog复制到我的本地应用。 当我尝试进行迁移时,总是会出现以下错误:

RuntimeError: Conflicting 'product_product_options' models in application 'catalogue': <class 'oscar.apps.catalogue.models.Product_product_options'> and <class 'forked_apps.catalogue.models.Product_product_options'>.
RuntimeError:应用程序“目录”中的“产品”和“产品”选项”模型冲突:和。
我尝试从我的本地目录应用程序(我以前从奥斯卡应用程序复制的)中删除所有迁移,然后它就可以工作了,但所有新迁移都是在奥斯卡源代码文件夹中创建的,但我需要它们在我的项目中


如何克服此错误?

无论您在哪里使用
产品
型号,请确保您都在使用以下各项:

from oscar.core.loading import get_model

Product = get_model('catalogue', 'Product')
如果您在代码的某个地方编写如下导入:

from oscar.apps.catalogue.models import Product
您将遇到此问题

from oscar.apps.catalogue.models import Product