Commit ad2b7df7 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

added rate limits on lookouts

parent 509d66a5
......@@ -4,12 +4,12 @@ from django.http import HttpResponseForbidden
from django.views.generic import CreateView, DetailView, DeleteView
# third-party imports
from braces.views import LoginRequiredMixin
from ratelimit.decorators import ratelimit
# imports from your apps
from .forms import LookoutForm
from .models import Lookout
class CreateLookout(LoginRequiredMixin, CreateView):
model = Lookout
fields = ['isbn', ]
......@@ -31,6 +31,11 @@ class CreateLookout(LoginRequiredMixin, CreateView):
return context
@ratelimit(key='user', rate='5/m', method='POST', block=True)
@ratelimit(key='user', rate='100/d', method='POST', block=True)
def post(self, request, *args, **kwargs):
return super(CreateLookout, self).post(request, *args, **kwargs)
class DetailLookout(LoginRequiredMixin, DetailView):
model = Lookout
......
Markdown is supported
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