comparison gpp/messages/views.py @ 156:7ad1f3e77cd9

Messages: use post to delete and undelete messages.
author Brian Neal <bgneal@gmail.com>
date Sun, 20 Dec 2009 05:21:57 +0000
parents ab7830b067b3
children d51743322bb2
comparison
equal deleted inserted replaced
155:ef93dc9f1992 156:7ad1f3e77cd9
6 from django.http import HttpResponseRedirect 6 from django.http import HttpResponseRedirect
7 from django.contrib.auth.decorators import login_required 7 from django.contrib.auth.decorators import login_required
8 from django.shortcuts import get_object_or_404 8 from django.shortcuts import get_object_or_404
9 from django.core.urlresolvers import reverse 9 from django.core.urlresolvers import reverse
10 from django.http import Http404 10 from django.http import Http404
11 from django.views.decorators.http import require_POST
11 12
12 from messages.models import Message 13 from messages.models import Message
13 from messages.models import Options 14 from messages.models import Options
14 from messages.forms import ComposeForm 15 from messages.forms import ComposeForm
15 from messages.forms import OptionsForm 16 from messages.forms import OptionsForm
160 }, 161 },
161 context_instance = RequestContext(request)) 162 context_instance = RequestContext(request))
162 163
163 164
164 @login_required 165 @login_required
166 @require_POST
165 def delete(request, msg_id): 167 def delete(request, msg_id):
166 """ 168 """
167 Deletes a given message. The user must be either the sender or 169 Deletes a given message. The user must be either the sender or
168 receiver for this to succeed. 170 receiver for this to succeed.
169 """ 171 """
206 208
207 return box_redirect(request) 209 return box_redirect(request)
208 210
209 211
210 @login_required 212 @login_required
213 @require_POST
211 def undelete(request, msg_id): 214 def undelete(request, msg_id):
212 """ 215 """
213 Undeletes a given message. The user must be either the sender or 216 Undeletes a given message. The user must be either the sender or
214 receiver for this to succeed. 217 receiver for this to succeed.
215 """ 218 """