Opened 10 years ago
Last modified 10 years ago
#23473 closed Bug
Django prompts to create new migrations when none are needed when a class is used in a field declaration — at Initial Version
Reported by: | Dan Loewenherz | Owned by: | nobody |
---|---|---|---|
Component: | Migrations | Version: | 1.7 |
Severity: | Normal | Keywords: | |
Cc: | info+coding@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Create a model like so:
from django.db import models from django.utils.deconstruct import deconstructible @deconstructible class IgnoreFormatString(object): def __init__(self, s): self.s = s def __str__(self): return self.s def __mod__(self, k): return self class Product(models.Model): name = models.CharField(max_length=32, blank=True, null=True, error_messages={'invalid': IgnoreFormatString('At this time, we do not carry half-sizes. We recommend rounding up.')})
Create a migration, and then run it. If you run "./manage.py migrate" once again, you'll get prompted with
Your models have changes that are not yet reflected in a migration, and so won't be applied. Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
Running makemigrations will create another migration, yet this message will continue to appear if the migration has already been applied.
Note:
See TracTickets
for help on using tickets.