Among the additional apps I'm using for the project is django-profiles, which I had some issues setting up which are apparently common. The "Missing Manual" site –http://birdhouse.org/blog/2009/06/27/django-profiles/ – helped resolve those but may have led to the current problem.
I am using the signals.post_save.connect(create_profile, sender=User) recommended there. I was researching what might have gone wrong and came across this post on Google Groups and answer which states that “If you’re using a post_save signal on User you can’t do that because it results in a race condition." I’m wondering if this may be causing the issue and, obviously, what would be best to resolve it and get these tables into the new database and functioning.
This is the database model:
class UserProfile(models.Model):
user = models.OneToOneField(User, unique=True, related_name="profile")
first_name = models.CharField(max_length=25)
last_name = models.CharField(max_length=35)
email = models.EmailField()
birth_date = models.DateField(blank=True, null=True)
city = models.CharField(max_length=25)
state = models.CharField(max_length=20)
zip_code = models.CharField(max_length=10)
profile_pic = models.ImageField(upload_to='profilepictures', blank=True)
def __unicode__(self):
return " %s" % (self.user)
def get_absolute_url(self):
return ('profiles_profile_detail', (), { 'username': self.user.username })
get_absolute_url = models.permalink(get_absolute_url)
signals.post_save.connect(create_profile, sender=User)
Any insight into how to remedy this issue would be greatly appreciated.