I have a couple apps now, and they all seem fine, working great. I’m in the process of making a blog in Django and have found a weird issue. I am unable to add my “Post” model to the admin. I do the usual “pass”:
from django.db import models
class Tag(models.Model):
tagname = models.SlugField()
class Post(models.Model):
title = models.CharField(max_length=200)
slug = models.SlugField(prepopulate_from=('title',))
date = models.DateTimeField('Date published')
body = models.TextField()
tags = models.ManyToManyField(Tag)
lead_image = models.ImageField(upload_to='images/blog/', blank=True)
class Admin:
pass
And it gives me this error when i try to manage.py syncdb:
# python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 11, in ?
execute_manager(settings)
File "/usr/lib/python2.4/site-packages/django/core/management/__init__.py", line 272, in execute_manager
utility.execute()
File "/usr/lib/python2.4/site-packages/django/core/management/__init__.py", line 219, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.4/site-packages/django/core/management/base.py", line 72, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/lib/python2.4/site-packages/django/core/management/base.py", line 85, in execute
self.validate()
File "/usr/lib/python2.4/site-packages/django/core/management/base.py", line 112, in validate
num_errors = get_validation_errors(s, app)
File "/usr/lib/python2.4/site-packages/django/core/management/validation.py", line 28, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/usr/lib/python2.4/site-packages/django/db/models/loading.py", line 126, in get_app_errors
self._populate()
File "/usr/lib/python2.4/site-packages/django/db/models/loading.py", line 55, in _populate
self.load_app(app_name, True)
File "/usr/lib/python2.4/site-packages/django/db/models/loading.py", line 70, in load_app
mod = __import__(app_name, {}, {}, ['models'])
File "/var/www/vhosts/joshuajonah.com/django-projects/jj/../jj/blog/models.py", line 14
class Admin:
^
SyntaxError: invalid syntax
There is another app with a models.py that has the same code in it and it just adds it to the admin and works great, any idea on why this one doesn’t like me?