Thursday, April 26, 2012

Re: Can't get model to show up in admin interface

Perhaps the Coltrane folder needs a blank __init__.py?

Sent from my iPhone

On Apr 27, 2012, at 12:00 AM, Mika <schillermika@gmail.com> wrote:

> I'm working through James Bennet's Practical Django Projects 2nd
> edition. I have a folder called "coltrane" which has a models.py file
> with the following:
>
> from django.db import models
>
> class Category(models.Model):
> title = models.CharField(max_length = 250)
> slug = models.SlugField(unique = True)
> description = models.TextField()
>
> def__unicode__(self):
> return self.title
>
> I want to be able to manage this model through the admin interface so
> I've added the folder name to the INSTALLED_APPS setting of the
> project like so:
>
> INSTALLED_APPS = (
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.admin',
> 'django.contrib.flatpages',
> 'coltrane',
>
> )
>
> Now I want to see it on the dev server, so I cd into the directory
> that contains the INSTALLED_APPS setting and run python manage.py
> syncdb to install the table. But I keep getting an error message that
> reads "Error: No module named coltrane".
>
> Any idea why this is happening?
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment