django-birthday icon indicating copy to clipboard operation
django-birthday copied to clipboard

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

Open maoaiz opened this issue 5 years ago • 2 comments

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?

maoaiz avatar Jun 14 '20 17:06 maoaiz

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

bashu avatar Oct 09 '21 13:10 bashu

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

maoaiz avatar Oct 10 '21 19:10 maoaiz