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

这一生的挚爱 提交于 2019-12-04 06:03:15

问题


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?


回答1:


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.




回答2:


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)


来源:https://stackoverflow.com/questions/32046762/how-to-register-a-new-model-in-django-oscar-dashboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!