Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add additional field to django oscar product field in dashboard

How do I add an additional field to django-oscar dashboard? I've forked catalog app added an extra field, but the form is not showing after forking dashboard.

from django.db import models
from oscar.apps.catalogue.abstract_models import AbstractProduct


class Product(AbstractProduct):
    file = models.FileField(upload_to='files/%Y/%m/%d')


from oscar.apps.catalogue.models import *

dashboard/catalogue/forms.py

from oscar.apps.dashboard.catalogue import forms as base_forms


class ProductForm(base_forms.ProductForm):

    class Meta(base_forms.ProductForm.Meta):

        fields = ('file',)
like image 347
Martins Avatar asked Sep 28 '19 13:09

Martins


1 Answers

First, create a directory to hold the forked app example forked_app_dir next use oscar_fork_app utility (which is very very poorly documented when you want to fork the dashboard apps) in my case, I wanted to fork the catalogue dashboard app so I did ./manage.py oscar_fork_app dashboard then changed into the dashboard directory and did ./manage.py oscar_fork_app catalogue_dashboard which created another dashboard dir which I removed and everything worked fine after applying changes forms in the dashboard.

like image 150
Martins Avatar answered Sep 19 '22 04:09

Martins