title: Updating model in Django based on dictionary values
body: <p>I have a dictionary in Django, contains a model's keys and some values. I want to update one of field (<em>score</em>) of the model (<em>A</em>) like this:
  multiply that field for all the records to a constant, and then, if the record was found in the dictionary, add the corresponding dict value to the field. there are many records, and getting and then saving each object takes lots of time. I tried this update query, but it is not working:</p>
  
  <p><code>A.objects.update(score=F('score') * CONST + (dictionary[F('key')] if F('key') in dictionary else 0))</code></p>
  
  <p>the problem is that the condition seems to be false for all of the records, I tried to debug the problem, and it seems <code>F('key')</code> doesn't have the desired value (a string).</p>
  
  <p>for further information, this line have the correct result:</p>
  
  <p><code>a = A.objects.get(key='key1')
  a.score * CONST + (dictionary[a.key] if a.key in dictionary else 0)</code></p>