views:

298

answers:

2

I've just installed django on my mac os x snow leopard and got some issues with it. I just made a very simple project that only contains a simple app.
The app contains just one model and it's a task. When running syncdb the table for tasks is created without any problems and I'm requested to create new user.
Everything works fine and I can log in and so on but my app is not showing up.

Here is some 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()

Maybe it's worth to mention that there is a __init__.py in both work and the work/todo folder.


Cheers, nandarya

+2  A: 

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 :)

cpharmston
Thanks, it solved the problem! You wanna trade eyes? ^__^
nandarya
Trust me, you don't want these eyes. Just ask the guys who sit next to me at work :)
cpharmston
A: 

That solved my problem as well. Thanks a lot!

PythonUser