Friday, February 27, 2015

Re: Migrations force me to have, forever, any name/reference I use in field validators=, choices=, whatever, valid forever (even if the requirements change).

Hello,

another solution may be to patch your models in the migration module or class, like:

import myapp.models

myapp.models.valid_identifier = something_acceptable()

Although it seems a bit ugly, I just tested it, and it works. This way valid_identifier will live during the migration only.

Best,
Gergely

On 27 Feb 2015 21:17, "Luis Masuelli" <luisfmasuelli@gmail.com> wrote:
Thanks :D Did not think about squashing migrations as solution for this problem! But it does the job.
OTOH the fact about historical models has nothing to do with my problem (since it is not related at all with instancing a model, but just about the definition and not getting a NameError).

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/15bb8a96-18a5-432c-afeb-7a3299ca7a4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACczBUJz9A%2ByKxTkP-prtfXihoSudM6V0HLD_mXUZTu2yQqjkg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment