Application will not display in django admin

I just installed django on my mac os x snow leopard and got some problems with it. I just made a very simple project that contains only a simple application.

The application contains only one model, and this is the task. When syncdb starts, the table for tasks is created without any problems, and I am invited to create a new user.
Everything works fine, and I can log in and so on, but my application does not appear.

Here is the code from my project.

settings.py

INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'work.todo', ) 

TODO / admin.py

 from work.todo import Task from django.contrib import admin admin.site.register(Task) 

urls.py

 from django.conf.urls.defaults import * # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Example: # (r'^work/', include('work.foo.urls')), # Uncomment the admin/doc line below and add 'django.contrib.admindocs' # to INSTALLED_APPS to enable admin documentation: (r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: (r'^admin/', include(admin.site.urls)), ) 

TODO / models.py

 from django.db import models class Task(models.Model): text = models.CharField(max_length=200) done = models.BooleanField() 

It may be worth mentioning that there is __init__.py both in work and in the work / todo folder.


Cheers nandarya

+4
source share
1 answer

In todo / admin.py:

 from work.todo.models import Task from django.contrib import admin admin.site.register(Task) 

You forgot models in your import statement :)

+5
source

All Articles