]> git.openstreetmap.org Git - osqa.git/commitdiff
the mark_favorite view should accept not only Questions but any Nodes (required for...
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 5 Jan 2012 23:54:01 +0000 (23:54 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 5 Jan 2012 23:54:01 +0000 (23:54 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1219 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/views/commands.py

index 30e835306dc0b8f126a43f242c949efe129a6b1f..2f35c1ecc82abc7f866ebf3287526f3f41e9eddd 100644 (file)
@@ -218,17 +218,17 @@ def delete_comment(request, id):
 
 @decorate.withfn(command)
 def mark_favorite(request, id):
 
 @decorate.withfn(command)
 def mark_favorite(request, id):
-    question = get_object_or_404(Question, id=id)
+    node = get_object_or_404(Node, id=id)
 
     if not request.user.is_authenticated():
         raise AnonymousNotAllowedException(_('mark a question as favorite'))
 
     try:
 
     if not request.user.is_authenticated():
         raise AnonymousNotAllowedException(_('mark a question as favorite'))
 
     try:
-        favorite = FavoriteAction.objects.get(canceled=False, node=question, user=request.user)
+        favorite = FavoriteAction.objects.get(canceled=False, node=node, user=request.user)
         favorite.cancel(ip=request.META['REMOTE_ADDR'])
         added = False
     except ObjectDoesNotExist:
         favorite.cancel(ip=request.META['REMOTE_ADDR'])
         added = False
     except ObjectDoesNotExist:
-        FavoriteAction(node=question, user=request.user, ip=request.META['REMOTE_ADDR']).save()
+        FavoriteAction(node=node, user=request.user, ip=request.META['REMOTE_ADDR']).save()
         added = True
 
     return {
         added = True
 
     return {