While upgrading django version from 1.7
to 1.8
, I got a new migration called 0002_remove_content_type_name
, after that I migrated that file, then I run my project, after that, it shows below error.
(1054, "Unknown column 'django_content_type.name' in 'field list'")
Then I checked the ContentType
model in django.contrib
files in packages, there I found the below code,
class ContentType(models.Model):
name = models.CharField(max_length=100)
app_label = models.CharField(max_length=100)
model = models.CharField(_('python model class name'), max_length=100)
objects = ContentTypeManager()
Due to the available of name
field, I got the unknown column error, We should not edit the package file(like commenting the name
field list in the model file), also we have to migrate
the changes given when upgrading django version 1.7 to 1.8
.
Give me the best solution to resolve this issue. Thanks.
You can delete migration file and try again to migrate, also in case of repeating this problem - delete migration folder of the current app and migrate again.