Commit f183aff8 authored by ViolanteCodes's avatar ViolanteCodes
Browse files

added template render with 403 status code for exception.isRateLimited

parent c60cb76d
......@@ -17,16 +17,15 @@ from django.contrib import admin
from django.urls import path, include
from ratelimit.exceptions import Ratelimited
from django.http import HttpResponse
from django.shortcuts import redirect
from django.shortcuts import redirect, render
def handler403(request, exception=None):
"""Custom 403 handler for ratelimit exceptions."""
response_message = """This ticket has failed due to too many requests in
a short period of time. If you like, you can hit the "back" button to return
to your form. Your data should still be filled in. You can then
wait and retry creating your ticket."""
if isinstance(exception, Ratelimited):
return HttpResponse(response_message, status=403)
return render(
return HttpResponseForbidden('Forbidden')
urlpatterns = [
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment