如何在 Django-Oscar 仪表板中注册一个新模型?

How to register a new Model in Django-Oscar Dashboard?

我分叉了 catalogue 应用并在新应用的 models.py

中添加了一个新模型
class BundleProductClass(Product):
    products = models.ManyToManyField(Product, related_name="bundle_products")

    class Meta:
        verbose_name = 'Bundle Product'

在admin.py注册了新模型 admin.site.register(BundleProductClass)

我可以在 /admin url 中看到新模型,但在 /dashboard 中它没有注册。我需要做什么才能在仪表板视图中注册它?

Oscar 仪表板未链接到 Django 管理。

如果您想通过 Oscar 仪表板管理模型,您必须创建自己的视图和 add them to the dashboard navigation

更改分叉的应用程序 admin.py 对我有用

#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)