Created
April 22, 2011 08:04
-
-
Save Alir3z4/936250 to your computer and use it in GitHub Desktop.
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
@login_required | |
def delete(request, msg_pk): | |
msg = get_object_or_404(Message, pk=msg_pk) | |
## is owner? | |
if request.user != msg.user and request.user != msg.to: | |
raise Http404() | |
# Sender or Receiver ? | |
if msg.delete_status == 2: | |
msg.delete_status = 3 | |
elif request.user == msg.user and request.user != msg.to: | |
msg.delete_status = '1' | |
elif request.user == msg.to: | |
msg.delete_status = '2' | |
msg.save() | |
# Send sucessfull message for user with messages framework | |
return HttpResponse(status=200) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment