RuntimeError: Conflicting 'product_product_options' models in application 'catalogue'

我的梦境 提交于 2019-12-21 20:08:12

问题


Version Info: Python 3.4, Django 1.8, Oscar Commerce - VERSION = (1, 2, 1, 'final')

I am trying to customize Products in the catalogue app following the documentation.

Having forked the catalogue app, I have defined models.py as follows:

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 *

I have already included the modified catalogue, in the INSTALLED_APPS in settings.py as a list, as suggested for a similar problem here.

INSTALLED_APPS = INSTALLED_APPS + get_core_apps(
      ['app.gravytrain.catalogue',])

Have copied the migration folder from oscar/apps/catalogue to my custom app. However running migration causes the following error:

RuntimeError: Conflicting 'product_product_options' models in
application 'catalogue': <class
'gravytrain.catalogue.models.Product_product_options'> and <class
app.gravytrain.catalogue.models.Product_product_options'>.

How do I get over this error ?


回答1:


If you want to import some models, you need use get_model function. For example:

from oscar.core.loading import get_model
Product = get_model('catalogue', 'Product')



回答2:


I had the same error. I have also included "from oscar.apps.catalogue.models import *" in the top of the model. Once I was removed it, that issue fixed.



来源:https://stackoverflow.com/questions/37271185/runtimeerror-conflicting-product-product-options-models-in-application-catal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!