How to register a new Model in Django-Oscar Dashbo

2020-05-06 08:08发布

I forked catalogue app and added a new model in the new app's models.py

class BundleProductClass(Product):
    products = models.ManyToManyField(Product, related_name="bundle_products")

    class Meta:
        verbose_name = 'Bundle Product'

In admin.py registered the new model admin.site.register(BundleProductClass)

I can see the new model in /admin url but in /dashboard it is not registered. What do I have to do to register it in dashboard view?

2条回答
迷人小祖宗
2楼-- · 2020-05-06 08:55

Changing the forked app admin.py worked for me

#catalogue/admin.py
from oscar.apps.catalogue.admin import *  # noqa
from modapps.catalogue.models import Brand

class BrandAdmin(admin.ModelAdmin):
    list_display = [ 'id']


admin.site.register(Brand, BrandAdmin)
查看更多
啃猪蹄的小仙女
3楼-- · 2020-05-06 09:07

The Oscar dashboard is not linked to the Django admin.

If you want to manage a model through the Oscar dashboard, you have to create your own views and add them to the dashboard navigation.

查看更多
登录 后发表回答