[Fixed]-Why is Django (1.8.3) migrations dropping fields in migration when they're still in the model

1👍

My guess is that you ‘shadowed’ the field, by creating an attribute or method with the same name.

class CandidateProfile(models.Model):
    party = models.ForeignKey(PoliticalParty, related_name="candidate_party", null=True, blank=True)

    def party(self):
        """This method will replace the model field"""
        return ''

If you didn’t do this, then please try to provide instructions that can recreate the issue (preferably with the latest point release 1.8.7). Dropping an existing field is a very serious data loss issue, and the Django developers would take it very seriously.

Leave a comment