Mercurial > public > sg101
comparison forums/views/spam.py @ 1032:e932f2ecd4a7
Django 1.8 warnings / tech debt cleanup.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 26 Dec 2015 15:10:55 -0600 |
parents | 9e803323a0d0 |
children |
comparison
equal
deleted
inserted
replaced
1031:e1c03da72818 | 1032:e932f2ecd4a7 |
---|---|
7 | 7 |
8 from django.contrib.auth.decorators import login_required | 8 from django.contrib.auth.decorators import login_required |
9 from django.core.urlresolvers import reverse | 9 from django.core.urlresolvers import reverse |
10 from django.http import HttpResponseRedirect | 10 from django.http import HttpResponseRedirect |
11 from django.shortcuts import get_object_or_404 | 11 from django.shortcuts import get_object_or_404 |
12 from django.shortcuts import render_to_response | 12 from django.shortcuts import render |
13 from django.template import RequestContext | |
14 from django.contrib.auth.models import User | 13 from django.contrib.auth.models import User |
15 | 14 |
16 from forums.models import Post | 15 from forums.models import Post |
17 import forums.permissions as perms | 16 import forums.permissions as perms |
18 import bio.models | 17 import bio.models |
64 request.user.username, poster.username, post.user_ip, post.body) | 63 request.user.username, poster.username, post.user_ip, post.body) |
65 | 64 |
66 return HttpResponseRedirect(reverse('forums-spammer_nailed', args=[ | 65 return HttpResponseRedirect(reverse('forums-spammer_nailed', args=[ |
67 poster.id])) | 66 poster.id])) |
68 | 67 |
69 return render_to_response('forums/spammer.html', { | 68 return render(request, 'forums/spammer.html', { |
70 'can_moderate': can_moderate, | 69 'can_moderate': can_moderate, |
71 'can_deactivate': can_deactivate, | 70 'can_deactivate': can_deactivate, |
72 'post': post, | 71 'post': post, |
73 }, | 72 }) |
74 context_instance=RequestContext(request)) | |
75 | 73 |
76 | 74 |
77 @login_required | 75 @login_required |
78 def spammer_nailed(request, spammer_id): | 76 def spammer_nailed(request, spammer_id): |
79 """This view presents a confirmation screen that the spammer has been | 77 """This view presents a confirmation screen that the spammer has been |
82 user = get_object_or_404(User, pk=spammer_id) | 80 user = get_object_or_404(User, pk=spammer_id) |
83 profile = user.profile | 81 profile = user.profile |
84 | 82 |
85 success = not user.is_active and profile.status == bio.models.STA_SPAMMER | 83 success = not user.is_active and profile.status == bio.models.STA_SPAMMER |
86 | 84 |
87 return render_to_response('forums/spammer_nailed.html', { | 85 return render(request, 'forums/spammer_nailed.html', { |
88 'spammer': user, | 86 'spammer': user, |
89 'success': success, | 87 'success': success, |
90 }, | 88 }) |
91 context_instance=RequestContext(request)) | |
92 | 89 |
93 | 90 |
94 @login_required | 91 @login_required |
95 def stranger(request, post_id): | 92 def stranger(request, post_id): |
96 """This view allows a forum moderator or super user to promote a user from | 93 """This view allows a forum moderator or super user to promote a user from |
109 logging.info("STRANGER PROMOTED: %s promoted %s.", | 106 logging.info("STRANGER PROMOTED: %s promoted %s.", |
110 request.user.username, poster.username) | 107 request.user.username, poster.username) |
111 | 108 |
112 return HttpResponseRedirect(post.get_absolute_url()) | 109 return HttpResponseRedirect(post.get_absolute_url()) |
113 | 110 |
114 return render_to_response('forums/stranger.html', { | 111 return render(request, 'forums/stranger.html', { |
115 'can_moderate': can_moderate, | 112 'can_moderate': can_moderate, |
116 'can_promote': can_promote, | 113 'can_promote': can_promote, |
117 'post': post, | 114 'post': post, |
118 }, | 115 }) |
119 context_instance=RequestContext(request)) |