Django Makemigrations Wants to Remove an Existing Field

Django migrations are awesome. But even the docs say you should inspect the proposed migrations before running “migrate”. Recently I ran “makemigrations” and Django wanted to remove a field that was still in my model. What’s going on here?

In this case, the model had lots of fields and added @property methods. It turns out that there was a @property method that had the same name as a model field. I will not go into details about how this happened. Anyway, it turns out that the @property method was an error. Removing it and deleting the migration file fixed the problem.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s