Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Methods don't work due to the internal field non-updated. #5

Open
maoaiz opened this issue Jun 14, 2020 · 2 comments
Open

Methods don't work due to the internal field non-updated. #5

maoaiz opened this issue Jun 14, 2020 · 2 comments
Assignees

Comments

@maoaiz
Copy link

maoaiz commented Jun 14, 2020

When you already have a model with a DateField for birthdays and you change that field for BirthdayField field you don't have the %s_dayofyear_internal field updated due to this field is updated with a pre_save signal. So, you can not use the provided methods.

You have to use something like [c.save() for c in Client.objects.all()] to update all your Client objects getting the presignal executed for each object.

It's a good idea you to document this problem in your docs.

Do you know a better way to update that field instead of use that loop?

@bashu bashu self-assigned this Jun 15, 2020
@bashu bashu changed the title Methods don't work due to the internal fiel unupdated. Methods don't work due to the internal field unupdated. Oct 9, 2021
@bashu bashu pinned this issue Oct 9, 2021
@bashu
Copy link
Owner

bashu commented Oct 9, 2021

to @maoaiz what do you think about adding post_migrate handler, that will find all models using BirthdayField and auto-update them?

@bashu bashu changed the title Methods don't work due to the internal field unupdated. Methods don't work due to the internal field non-updated. Oct 10, 2021
@maoaiz
Copy link
Author

maoaiz commented Oct 10, 2021

@bashu that is a good idea; this should be transparent to the developer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants