Django admin not showing models

后端 未结 6 1657
悲&欢浪女
悲&欢浪女 2021-02-07 09:27

I\'m damned if I can figure out why my models are not showing in the admin.

models.py looks like this:

from django.db import models

class Publication(mo         


        
6条回答
  •  心在旅途
    2021-02-07 09:34

    This happens to my case, it may not be the same as yours.

    Check if you have admin.pyc being created, if it is not being created then it is not being called. If it is not being called then one of the cause is you have xrdb/xrdb/admin folder with __init__.py in it.

    I guess there can be other ways to do this but for me I created a file that would look to your case as publications_admin.py inside xrdb/xrdb/admin and add import xrdb.admin.publications_admin inside xrdb/xrdb/admin/__init__.py.

    Do the registration inside publications_admin.py, that would look something like.

    from django.contrib import admin
    from xrdb.models import Publications
    
    admin.site.register(Publications)
    

    I hope it helps. Cheers!

提交回复
热议问题