Reputation: 511
I`m trying to add my models ( the models are named "Question" and "Answer" respectively allocated in models.py archive) to the Django admin control center. So, to do that I make the following the settings in the following archives:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admindocs',
'questionsandanswers',
)
After that I synchronize the database again to commit the change.
python manage.py syncdb
In the urls.py file I have the following setting:
from django.conf.urls import patterns, include, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'miprimerproyecto.views.home', name='home'),
url(r'^blog/', include('blog.urls')),
................
url(r'^admin/', include(admin.site.urls)),
)
The admin.py file allocated inside of the models folders, has the following configuration:
from django.contrib import admin
from questionsandanswers.models import Question, Answer
admin.site.register(Question)
admin.site.register(Answer)
After the I restart the server again:
python manage.py runserver
But the when I enter in the admin console I don' t see the models on the board.
I would be very grateful If somebody could help me to solve this issue.
Upvotes: 0
Views: 935
Reputation: 69
Instead of running python manage.py syncdb
try python manage.py makemigrations
and then run python manage.py migrate
then start your server and check again
Upvotes: 0
Reputation: 37319
You probably don't have permissions set for those models yet. You can check that by logging in with a superuser account, which has all permissions. If your superuser account shows the admin options for the new models but your regular account doesn't, that confirms that your regular account lacks permissions for those models. You can use the superuser account to add permissions to a group or directly to the account you'd like to use in the auth
admin.
Upvotes: 2