mardi 3 mai 2016

Adding fields to existing model doesn't work in Django

I have already created own model with OneToOneField with User-model. Now, I want to add field to that model, but doing manage.py makemigrations and migrate doesn't see any changes, which I made to my models.py.

models.py:

class UserDetails(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE,)
    footsize = models.CharField(max_length=10)
    headsize = models.CharField(max_length=10)

    handsize = models.CharField(max_length=100) #field what I want to add

    def __str__(self):
        return u'%s %s %s' % (self.id, self.footsize, self.headsize)

If I try to add values to handsize with shell, I get an error that the handsize field doesn't exists. What's the problem?

Aucun commentaire:

Enregistrer un commentaire