django-oscar / django-oscar

Domain-driven e-commerce for Django

Home Page:http://oscarcommerce.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug when forking offer.benefits

dylanGerlach opened this issue · comments

Issue Summary

When forking offer, and overriding the class in the benefits file, you get this error: raise RuntimeError(
RuntimeError: Conflicting 'percentagediscountbenefit' models in application 'offer': <class 'apps.offer.benefits.PercentageDiscountBenefit'> and <class 'oscar.apps.offer.benefits.PercentageDiscountBenefit'>. In offer/models.py the specific files are referenced which I know is against django-oscars development process, but the changes I tried to make to that as a quick fix didn't work.
--- # Import the benefits and the conditions. Required after initializing the

parent models to allow overriding them

from oscar.apps.offer.benefits import *
from oscar.apps.offer.conditions import *

from oscar.apps.offer.benefits import all as benefit_classes
from oscar.apps.offer.conditions import all as condition_classes

all.extend(benefit_classes)
all.extend(condition_classes) ---

Steps to Reproduce

Just fork the offer.benefits and override a class, I specifically am trying to override PercentageDiscountBenefit

Technical details

Python 3.10.11
Name: Django
Version: 4.2.9
Name: django-oscar
Version: 3.2.2