overriding StockRecordForm

29 views
Skip to first unread message

Max

unread,
Nov 29, 2015, 10:56:40 AM11/29/15
to django-oscar
Hello,

Is there any particular reason why StockRecordForm  for StockRecordFormSet cannot be overriden?

I had to change oscar\apps\dashboard\catalogue\forms.py:

BaseStockRecordFormSet = inlineformset_factory(
    Product, StockRecord, form=StockRecordForm, extra=1)

to 

BaseStockRecordFormSet = inlineformset_factory(
Product, StockRecord, form=get_class("dashboard.catalogue.forms", "StockRecordForm"), extra=3)

after this chanage oscar detects my  StockRecordForm changes.

I suppose every oscar's formset works the same way.

Thanks,
Max

maik

unread,
Dec 30, 2015, 9:04:55 AM12/30/15
to django-oscar
Hi Max,

you're right, it's quite annoying to do this. I'm not sure if your approach of keeping them in the same file generally works; I fear it would cause circular import issues. But it should be addressed nonetheless; I created https://github.com/django-oscar/django-oscar/issues/1957 to track the issue. If you have the time, you're welcome to submit a PR. 

Cheers,

Maik
Reply all
Reply to author
Forward
0 new messages