[Answered ]-Django – Use signals to refresh another model's fields

2👍

Just use:

for model_b in ModelB.objects.filter(<some_filter>):
    model_b.save()

But you should be aware that this pulls all (filtered) objects to Django, there do something with them and saves them back to the database. This is much slower than using query expressions. You will have a little bit more work to set it up, but it will run much faster – especially when database grows.

Leave a comment