1👍
You should use migrations to edit database structure:
https://docs.djangoproject.com/en/1.7/topics/migrations/
Or, if your django version is less than 1.7, South package:
1👍
Just run makemigrations
and migrate
commands:
python manage.py makemigrations
python manage.py migrate
UPDATE: makemigrations
/migrate
commands are available since django 1.7.
As @eugene-soldatov mentioned in his answer for django 1.5 you can use the South
app.
Another option is to alter the table manually by executing the following SQL query:
echo "ALTER TABLE myapp_photo ADD COLUMN photo_dpi VARCHAR(500) NULL;" | python manage.py dbshell
Where myapp
is the name of your application.
- [Answered ]-How to import packages in virtualenv in python shell
- [Answered ]-Parse european string date to Django DateField
- [Answered ]-Django – Use signals to refresh another model's fields
- [Answered ]-Where to find the default context processors in django 1.10?
- [Answered ]-Django Multiple db with read only
Source:stackexchange.com