model not showing up in django admin
I know this has already been answered and accepted, but I felt like sharing what my solution to this problem was, maybe it will help someone else.
My INSTALLED_APPS
looked like this:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'core', # <---- this is my custom app
# Uncomment the next line to enable the admin:
'django.contrib.admin',
'south',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
See, I put my app before Django's admin app, and apparently it loads them in that order. I simply moved my app right below the admin, and it started showing up :)
Had the same issue with Django 2.0.
The following code didn't work:
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from users import models
admin.register(models.User, UserAdmin)
It turns out the line
admin.register(models.User, UserAdmin)
should have been
admin.site.register(models.User, UserAdmin)
Since I didn't get any warnings, just wanted to point out this thing here too.
Hmmmm...Try change include of your app in settings.py:
From:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'game',
....
To:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'YOUR_PROJECT.game',# OR 'YOUR_PROJECT.Game'
The problem reported can be because you skipped registering the models for the admin site. This can be done, creating an admin.py
file under your app, and there registering the models with:
from django.contrib import admin
from .models import MyModel
admin.site.register(MyModel)