Skip to content
Advertisement

Django oscar – customizing StockRecordForm form

I am trying to customize StockRecordForm in django-oscar administration. What I have:

  1. Forked dashboard app, also catalogue_dashboard
  2. Included new StockRecord attribute in models.py
  3. Updated forms.py like this:
from oscar.apps.dashboard.catalogue import forms as base_forms

class StockRecordForm(base_forms.StockRecordForm):


    class Meta(base_forms.StockRecordForm.Meta):
        fields = [
            'partner', 'partner_sku',
            'price_currency', 'price',
            'num_in_stock', 'low_stock_threshold', 'new_attribute',
        ]

Part of my INSTALLED_APPS looks like this:

#'oscar.apps.dashboard.apps.DashboardConfig',
#'oscar.apps.dashboard.catalogue.apps.CatalogueDashboardConfig',
'mikeapps.dashboard.apps.DashboardConfig',
'mikeapps.dashboard.catalogue.apps.CatalogueDashboardConfig',

But modification is not showing up. Is there anything else I should modify?

Advertisement

Answer

Allright, I am surprised that in this case I have to actually modify template to show the new fields (unlike ProductForm etc.), I presumpted that all chosen attributes will be shown in forms automatically, but I was wrong.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement