geex-arts / django-jet

Modern responsive template for the Django admin interface with improved functionality. We are proud to announce completely new Jet. Please check out Live Demo
https://github.com/jet-admin/jet-bridge
GNU Affero General Public License v3.0
3.55k stars 777 forks source link

Django Polymorphic admin issues #187

Open jab3z opened 7 years ago

jab3z commented 7 years ago

Hi,

Polymorphic it's using the same admin urls/views for base models and children models. Check docs here. While the index page doesn't show children models, if a detail of an object it's browsed, links to children models are displayed on the menu, even the links return 404, because they are not registered in admin.

Index page menu:

administration___site_admin

Detail page of an ordinary common object:

select_currency_to_change___site_admin

Cheers!

Ismael-VC commented 7 years ago

Could you please clear your cache browser and try again_ If that doesn't fix this for you, please try to provide a minimal example that is able to reproduce this issue. Which browser are you using?

jab3z commented 7 years ago

For sure it's not cache 😅

Docs examples here.

models.py

from polymorphic.models import PolymorphicModel

class ParentModel(PolymorphicModel):
    name = models.CharField(_("Name"), max_length=24)

class ChildModel(ParentModel):
    pass   

admin.py

from polymorphic.admin import (PolymorphicParentModelAdmin, 
    PolymorphicChildModelAdmin, GatewayPolymorphicChildModelFilter)

@admin.register(ChildModel)
class ChildModelAdmin(PolymorphicChildModelAdmin):
    base_model = ParentModel

@admin.register(ParentModel):
class ParentModelAdmin(PolymorphicParentModelAdmin):
    base_model = ParentModel
    child_models = [ChildModel]

show_in_index is False by default.

Ismael-VC commented 6 years ago

Please come to the django-jet Discord server so we can organize if you like:

Welcome! 😄