[Django]-How to add a new field in django model

10👍

Database migrations are not built-in to Django, so you’ll need to use a third party library. I highly recommend south.

5👍

south is very nice and all that, but if this is a very rare one-off thing then just fire up your favourite mysql tool and do something like: ALTER TABLE foo ADD COLUMN wotsit VARCHAR(100) – I can’t remember the exact syntax…

But +1 for south.

-2👍

You have to dump your previous data.

manage.py dumpdata > dump.json

And you can load your data after syncdb. (“c” column have to permit null)

manage.py loaddata dump.json

Leave a comment