On Tue, Feb 15, 2011 at 8:06 AM, Chen Xu <[email protected]> wrote: > Hi, everyone: > I have a question about Django models, > so I created a Model: > > class Person(models.Model): > name = models.CharField(max_length=60) > > and ran the follwing: > > python manage.py syncdb > > this successfully did what I want, but later on, I added a new field into > a model > > class Person(models.Model): > GENDER_CHOICES = ( > (u'M', u'Male'), > (u'F', u'Female'), > ) > name = models.CharField(max_length=60) > gender = models.CharField(max_length=2, choices=GENDER_CHOICES) > > and I tried to run: > python manage.py syncdb again to sync my database, but it does not do it: > > So I am wondering if it is because since Person model already exists, it > will just simply ignore checking if the field changes. > And what I should do to sync the database?
You're correct, the syncdb command will not modify tables in your database. What you're looking for is called database migrations, and a lot of (most?) people using Django use something called South for that. Have a look at http://south.aeracode.org/docs/, the tutorial is great. Best regards, Martin Melin -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

