Permalink
Browse files

Merge pull request #6 from almalki/master

 	fix incompatibility with django 1.4
  • Loading branch information...
2 parents 1ef7d0e + 83bdc4e commit c1c961789e6ff4e222e7fe337af9fe7814d1e724 @paltman paltman committed Jan 2, 2013
Showing with 16 additions and 5 deletions.
  1. +10 −0 flag/templates/flag/thank_you.html
  2. +2 −0 flag/urls.py
  3. +4 −5 flag/views.py
@@ -0,0 +1,10 @@
+{% load i18n %}
+
+<h3>{% trans 'Thank you' %}</h3>
+{% if messages %}
+<div class="messages">
+ {% for message in messages %}
+ <p class=" alert alert-{% if message.tags %}{{ message.tags }}{% endif %}">{{ message }}</p>
+ {% endfor %}
+</div>
+{% endif %}
View
@@ -1,6 +1,8 @@
from django.conf.urls.defaults import *
+from django.views.generic import TemplateView
urlpatterns = patterns("",
url(r"^$", "flag.views.flag", name="flag"),
+ url(r'^thank_you', TemplateView.as_view(template_name="flag/thank_you.html"), name='flag-reported'),
)
View
@@ -1,9 +1,11 @@
+from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, Http404
from django.shortcuts import get_object_or_404
from django.contrib.auth.decorators import login_required
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext as _
+from django.contrib import messages
from flag.models import add_flag
@@ -28,12 +30,9 @@ def flag(request):
creator = None
add_flag(request.user, content_type, object_id, creator, comment)
- request.user.message_set.create(
- message = _("You have added a flag. A moderator will review your "
- "submission shortly.")
- )
+ messages.success(request, _("You have added a flag. A moderator will review your submission shortly."), fail_silently=True)
if next:
return HttpResponseRedirect(next)
else:
- return Http404
+ return HttpResponseRedirect(reverse('flag-reported'))

0 comments on commit c1c9617

Please sign in to comment.