[Django]-Problems adding SlugField field type (Django 1.6.3)

4đź‘Ť

âś…

Looks like you added slug to model AFTER run syncdb and BEFORE run convert_to_south. Specifically about your case south’s developer displays a warning message in the console:

Note that South assumed the application’s models matched the
database(i.e. you haven’t changed it since last syncdb); if you have,
you should delete the albums/migrations directory, revert models.py so
it matches the database, and try again.

For fixing your problem, you should:

  • Drop SlugField from Album (looks in your console output you should drop artist too)
  • Drop migrations folder from albums app
  • Run ./manage.py convert_to_south albums
  • Run ./manage.py migrate albums
  • Add SlugField
  • Run ./manage.py schemamigration albums –auto(Specify default value as ”)
  • Run ./manage.py migrate albums
  • Profit!
👤Alex Lisovoy

Leave a comment