RuntimeError: Conflicting 'product_product_opt

2019-04-09 12: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 ?

2条回答
狗以群分
2楼-- · 2019-04-09 12:27

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.

查看更多
三岁会撩人
3楼-- · 2019-04-09 12:32

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')
查看更多
登录 后发表回答