More pythonic
authorCharles Connell <charles@connells.org>
Tue, 21 Jan 2014 15:54:29 +0000 (10:54 -0500)
committerCharles Connell <charles@connells.org>
Tue, 21 Jan 2014 15:54:29 +0000 (10:54 -0500)
karmaworld/apps/notes/views.py

index 322aa004e808877a10bcc4f9f378702f9756fc30..98d476b13267e9c8297e3660fe26c889a4ca14a0 100644 (file)
@@ -239,7 +239,8 @@ def ajaxIncrementBase(request, pk, field):
     try:
         # Increment counter
         note = Note.objects.get(pk=pk)
-        note.__dict__[field] += 1
+        count = getattr(note, field)
+        setattr(note, field,  count+1)
         note.save()
 
         # Record that user has performed this, to prevent