Adding A Manytomanyfield Field To An Existing Model
I have a production model and I need to add the following field to it: tag = models.ManyToManyField(Tags) The following is not picking up the change: python manage.py syncdb And
Solution 1:
South would definitely help:
South is a tool to provide consistent, easy-to-use and database-agnostic migrations for Django applications.
Note that in Django 1.7 (currently in development stage) South is going to become a part of django (docs).
A good place to start is to go through the tutorial and how to start using South with an existing database page.
Also see:
- Django - syncdb doesn't create tables
- django-admin's syncdb does not check for missing many-to-many tables
- django adding a ManyToMany field/table to existing schema, related_name error
Note that creating a many-to-many table manually may look like an easy solution/workaround in a short-perspective, but I'd consider switching to south anyway.
Hope that helps.
Post a Comment for "Adding A Manytomanyfield Field To An Existing Model"