Code

Ticket #1659: userflags.2.diff

File userflags.2.diff, 3.6 KB (added by ubernostrum, 8 years ago)

Fix typo

Line 
1Index: userflags.py
2===================================================================
3--- userflags.py        (revision 2653)
4+++ userflags.py        (working copy)
5@@ -1,7 +1,7 @@
6 from django.shortcuts import render_to_response
7 from django.template import RequestContext
8 from django.http import Http404
9-from django.models.comments import comments, moderatordeletions, userflags
10+from django.contrib.comments.models import Comment, ModeratorDeletion, UserFlag
11 from django.contrib.auth.decorators import login_required
12 from django.http import HttpResponseRedirect
13 from django.conf import settings
14@@ -16,21 +16,21 @@
15             the flagged `comments.comments` object
16     """
17     try:
18-        comment = comments.get_object(pk=comment_id, site__id__exact=settings.SITE_ID)
19-    except comments.CommentDoesNotExist:
20+        comment = Comment.objects.get(pk=comment_id, site__id__exact=settings.SITE_ID)
21+    except Comment.DoesNotExist:
22         raise Http404
23     if request.POST:
24-        userflags.flag(comment, request.user)
25+        UserFlag.flag(comment, request.user)
26         return HttpResponseRedirect('%sdone/' % request.path)
27-    return render_to_response('comments/flag_verify', {'comment': comment}, context_instance=RequestContext(request))
28+    return render_to_response('comments/flag_verify.html', {'comment': comment}, context_instance=RequestContext(request))
29 flag = login_required(flag)
30 
31 def flag_done(request, comment_id):
32     try:
33-        comment = comments.get_object(pk=comment_id, site__id__exact=settings.SITE_ID)
34-    except comments.CommentDoesNotExist:
35+        comment = Comment.objects.get(pk=comment_id, site__id__exact=settings.SITE_ID)
36+    except Comment.DoesNotExist:
37         raise Http404
38-    return render_to_response('comments/flag_done', {'comment': comment}, context_instance=RequestContext(request))
39+    return render_to_response('comments/flag_done.html', {'comment': comment}, context_instance=RequestContext(request))
40 
41 def delete(request, comment_id):
42     """
43@@ -42,25 +42,25 @@
44             the flagged `comments.comments` object
45     """
46     try:
47-        comment = comments.get_object(pk=comment_id, site__id__exact=settings.SITE_ID)
48-    except comments.CommentDoesNotExist:
49+        comment = Comment.objects.get(pk=comment_id, site__id__exact=settings.SITE_ID)
50+    except Comment.DoesNotExist:
51         raise Http404
52-    if not comments.user_is_moderator(request.user):
53+    if not Comment.objects.user_is_moderator(request.user):
54         raise Http404
55     if request.POST:
56         # If the comment has already been removed, silently fail.
57         if not comment.is_removed:
58             comment.is_removed = True
59             comment.save()
60-            m = moderatordeletions.ModeratorDeletion(None, request.user.id, comment.id, None)
61+            m = ModeratorDeletion(user=request.user, comment=comment)
62             m.save()
63         return HttpResponseRedirect('%sdone/' % request.path)
64-    return render_to_response('comments/delete_verify', {'comment': comment}, context_instance=RequestContext(request))
65+    return render_to_response('comments/delete_verify.html', {'comment': comment}, context_instance=RequestContext(request))
66 delete = login_required(delete)
67 
68 def delete_done(request, comment_id):
69     try:
70-        comment = comments.get_object(pk=comment_id, site__id__exact=settings.SITE_ID)
71-    except comments.CommentDoesNotExist:
72+        comment = Comment.objects.get(pk=comment_id, site__id__exact=settings.SITE_ID)
73+    except Comment.DoesNotExist:
74         raise Http404
75     return render_to_response('comments/delete_done', {'comment': comment}, context_instance=RequestContext(request))