Django South does not create table for user_profiles

I wanted to reset the Django project database, so I took the following steps:

  • Remote SQLite Database
  • Done python manage.py syncdb
  • Done python manage.py migrate users --fake

After creating a new account and logging in, the following error message appears:

no such table: users_userprofile

This is what my model.py users look like:

class UserProfile(models.Model):
  user = models.OneToOneField(User)
  joined_goals = models.ManyToManyField(Goal, related_name="joined_goals")
  followingGoals = models.ManyToManyField(Goal, related_name="following_goals")

  def __unicode__(self):
    return self.user.username

  def get_goals(self):
    try:
      goals = Goal.objects.filter(user=self.user)
      return goals
    except Goal.DoesNotExist:
      return []

def create_user_profile(sender, instance, created, **kwargs):
    if created:
      userProfile = UserProfile.objects.create(user=instance)

post_save.connect(create_user_profile, sender=User)

So, there is a UserProfile class, but it seems the South did not force the table to hold user profiles. When I do python manage.py schemamigration users --auto, he says nothing has changed. How to get it to create userprofiles table?

+3
source share
3 answers

. , . , syncdb, :

python manage.py createsuperuser

syncdb. , post_save .

+6

-fake. , , , south_migrationhistory.

0

For some people, the following should work:

python manage.py schemamigration myapp --initial
python manage.py migrate myapp
0
source

All Articles