Is it possible to update multiple objects with on db call, but setting each selected item to a different value?
I know it can be done with the same value
my_articles = models.Article.objects.filter(...)
for article in my_articles:
article.name = 'foo'
article.save()
# is equivalent to
models.Article.objects.filter(...).update(name='foo')
But what if I want to do something like this?
my_articles = models.Article.objects.filter(...)
for article in my_articles:
article.name = get_new_name_for_this_one_article(article)
article.save()
# is equivalent to
???
Im using the mysql backend if that matters at all