From c3319e232a11e0549cab2e77ffe15d6c1e782e18 Mon Sep 17 00:00:00 2001 From: Charles Connell Date: Tue, 21 Jan 2014 10:54:29 -0500 Subject: [PATCH] More pythonic --- karmaworld/apps/notes/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/karmaworld/apps/notes/views.py b/karmaworld/apps/notes/views.py index 322aa00..98d476b 100644 --- a/karmaworld/apps/notes/views.py +++ b/karmaworld/apps/notes/views.py @@ -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 -- 2.25.1