url(r'^%s(?P<id>\d+)/(?P<slug>[\w-]*)$' % _('question/'),
'django.views.generic.simple.redirect_to', {'url': '/questions/%(id)s/%(slug)s'}),
+ url(r'^%s(?P<id>\d+)/?$' % _('questions/'), app.readers.question, name='question'),
url(r'^%s(?P<id>\d+)/(?P<slug>[\w-]*)$' % _('questions/'), app.readers.question, name='question'),
url(r'^%s(?P<id>\d+)/(?P<slug>[\w-]*)/(?P<answer>\d+)$' % _('questions/'), app.readers.question),
answer.question.get_absolute_url(), _('page'), page, answer.id))
@decorators.render("question.html", 'questions')
-def question(request, id, slug, answer=None):
+def question(request, id, slug=None, answer=None):
try:
question = Question.objects.get(id=id)
except:
return answer_redirect(request, answer)
+ if (not slug) or (slug != urlquote(slugify(question.title))):
+ return HttpResponsePermanentRedirect(question.get_absolute_url())
+
if request.POST:
answer_form = AnswerForm(question, request.POST)
else: