Ziad Ahmed
Ziad Ahmed

Reputation: 74

Customize dashboard catalogue forms in Django Oscar doesn't work

I have followed the main documentations for django oscar. and I am trying to add a new field to product named video_url.

first I add the new field to product models and it worked fine. catalogue/models.py

from django.db import models

from oscar.apps.catalogue.abstract_models import AbstractProduct

class Product(AbstractProduct):
    video_url = models.URLField(null=True, blank=True)

from oscar.apps.catalogue.models import *

and then I continue to customize the catalogue dashboard but it seems like it didn't change any thing there's no error or anythin.

dashboard/caralogue/forms.py

from oscar.apps.dashboard.catalogue.forms import ProductForm as CoreProductForm

class ProductForm(CoreProductForm):
    class Meta(CoreProductForm.Meta):
        fields = ['title', 'upc', 'description', 'is_public', 'is_discountable', 'structure', 'video_url']

myproject/settings.py

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # 'dashboard.catalogue',

    # Oscar
    'django.contrib.sites',
    'django.contrib.flatpages',

    'oscar',
    'oscar.apps.analytics',
    'oscar.apps.checkout',
    'oscar.apps.address',
    'oscar.apps.shipping',

    # My Catalogue
    'catalogue.apps.CatalogueConfig',
    # 'oscar.apps.catalogue',
    'oscar.apps.catalogue.reviews',
    'oscar.apps.partner',
    'oscar.apps.basket',
    'oscar.apps.payment',
    'oscar.apps.offer',
    'oscar.apps.order',
    'oscar.apps.customer',
    'oscar.apps.search',
    'oscar.apps.voucher',
    'oscar.apps.wishlists',
    'oscar.apps.dashboard',
    'oscar.apps.dashboard.reports',
    'oscar.apps.dashboard.users',
    'oscar.apps.dashboard.orders',

    # My Catalogue dashboard
    'dashboard.catalogue.apps.CatalogueDashboardConfig',
    # 'oscar.apps.dashboard.catalogue',
    'oscar.apps.dashboard.offers',
    'oscar.apps.dashboard.partners',
    'oscar.apps.dashboard.pages',
    'oscar.apps.dashboard.ranges',
    'oscar.apps.dashboard.reviews',
    'oscar.apps.dashboard.vouchers',
    'oscar.apps.dashboard.communications',
    'oscar.apps.dashboard.shipping',

    # 3rd-party apps that oscar depends on
    'widget_tweaks',
    'haystack',
    'treebeard',
    'sorl.thumbnail',
    'django_tables2',
]

Upvotes: 1

Views: 985

Answers (3)

Daz
Daz

Reputation: 45

Also Modify installed_apps oscar.apps.dashboard.apps.DashboardConfig, to yourapps.dashboard.apps.DashboardConfig.

Upvotes: 0

solarissmoke
solarissmoke

Reputation: 31474

You need to fork the core dashboard app (oscar.apps.dashboard) before you can fork any of it's sub-apps (oscar.apps.dashboard.catalogue) - that's the reason the dynamic loading isn't working currently.

This note has been added to the documentation but hasn't made it onto readthedocs.com yet.

Upvotes: 1

pythonoscar
pythonoscar

Reputation: 29

your app.py file it has to be

   import oscar.apps.dashboard.catalogue.apps as apps


   class CatalogueDashboardConfig(apps.CatalogueDashboardConfig):
        name = 'yourappsfolder.dashboard.catalogue'

Upvotes: 0

Related Questions