I'm assuming that it is because my superuser depends on UserProfile which has no existing data yet. My model looks like
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
class UserProfile(models.Model):
user = models.OneToOneField(User) # required
location = models.CharField(max_length=100)
age = models.PositiveIntegerField(blank=True,null=True)
contribution_points = models.PositiveIntegerField()
#acheivements = models.ManyToMany()
def create_user_profile(sender,instance,created,**kwargs):
if created:
UserProfile.objects.create(user=instance)
post_save.connect(create_user_profile, sender=User)
However, I end up with the following error:
django.db.utils.DatabaseError: (1146, "Table 'savory_db.login_userprofile' doesn't exist")
despite having just ran syncdb
Does my model have any contradictory fields that would cause this error. Should UserProfile not be applied to the superuser? How should I prevent this?