Przemysław Zamorski
Przemysław Zamorski

Reputation: 741

Conflicting 'order' models in application 'order'

I have a problem with overwitten model from Django oscar. I want add a new field to model but when i do it i have RuntimeError: Conflicting 'order' models in application 'order': and .

Thats my code myapp.oscar_apps.order.models.py

from oscar.apps.order.models import *  # noqa
from oscar.apps.order.abstract_models import AbstractOrder  # noqa
from django.db import models

class Order(AbstractOrder):
    hash = models.CharField(max_length=256, blank=True, null=True)


from oscar.apps.order.models import *

*myapp.oscar_apps.order.init.py

default_app_config = 'bakdrop.oscar_apps.order.config.OrderConfig'

*myapp.oscar_apps.order.config.py

from myapp.apps.order import config


class OrderConfig(config.OrderConfig):
    name = 'myapp.oscar_apps.order'

Can anybody help my solve this problem ?

Update my INSTALLED_APPS

 INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'django.contrib.flatpages',
    'compressor',
    'paypal',
    'crispy_forms',
    'django_select2',
    'myapp.apps.user',
    'myapp.apps.organization',
    'widget_tweaks',
    'djcelery',

] + get_core_apps([
                'myapp.apps.promotions',
                'myapp.oscar_apps.checkout',
                'myapp.oscar_apps.order',
                'myapp.oscar_apps.basket',
                'myapp.oscar_apps.shipping',
                'myapp.oscar_apps.payment',

            ])

Upvotes: 3

Views: 563

Answers (1)

djq
djq

Reputation: 15288

Instead of doing

from oscar.apps.order.models import *

I think you need

from myapp.oscar.apps.order.models import *

A good debugging strategy for this is to comment out all of these, and reintroduce them line by line. That way you can pin-point the error:

get_core_apps([
                'myapp.apps.promotions',
                #'myapp.oscar_apps.checkout',
                #'myapp.oscar_apps.order',
                #'myapp.oscar_apps.basket',
                #'myapp.oscar_apps.shipping',
                #'myapp.oscar_apps.payment',

            ])

Upvotes: 1

Related Questions