Last active
December 11, 2015 23:39
-
-
Save ollieglass/4678134 to your computer and use it in GitHub Desktop.
AJAX helper function for storing credit card transaction categories, from my personal finance mini-hackathon http://ollieglass.com/2013/01/30/personal-finance-mini-hackathon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def transaction(request): | |
transaction_id = request.REQUEST.get('transactionId') | |
category_id = request.REQUEST.get('categoryId') | |
t = Transaction.objects.get(pk=transaction_id) | |
m = t.merchant | |
c = Category.objects.get(pk=category_id) | |
m.category = c | |
m.save() | |
data = { | |
'merchant': m.name, | |
'category': c.name | |
} | |
return HttpResponse(json.dumps(data), content_type="application/json") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment