Monday, June 4, 2012

Using the django.contrib.auth User in my model - database error

Part of my application that uses the contrib,auth User 

from django.db import models
from django.contrib.auth.models import User

class Project(models.Model):

name = models.CharField(max_length=200)
startdate = models.DateField('Project Started')
enddate = models.DateField('Expected end date')
manager = models.ForeignKey(User,related_name="Expert")
users = models.ManyToManyField(User,related_name='project_users')

Then defined in admin.py

from coordination.models import *
from django.contrib import admin
from django.contrib.auth.models import User

class ProjectAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['name']}),
('People', {'fields': ['users'], 'classes' :['collapse']}),
('Date information', {'fields': ['startdate','enddate'] , 'classes' : ['collapse']}),]

admin.site.register(Project, ProjectAdmin)

I ran syncdb without a problem ,  then when I used the admin interface I get the following error :

Exception Type: DatabaseError at /admin/coordination/project/
Exception Value: no such column: coordination_project.manager_id

Kind regards , Jonathan



Request Method:GET
Request URL:http://localhost:8000/admin/coordination/project/
Django Version:1.4
Exception Type:DatabaseError
Exception Value:
no such column: coordination_project.manager_id
Exception Location:C:\Tools\Python2.7.2\lib\site-packages\django\db\backends\sqlite3\base.py in execute, line 337
Python Executable:C:\Tools\Python2.7.2\python.exe
Python Version:2.7.2

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/HaCbZOJzYekJ.
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