1
0
Fork 0
mirror of synced 2024-06-26 10:00:19 +12:00

Merge pull request #777 from tjhorner/exempt-add-from-csrf

Exempt /add route from CSRF
This commit is contained in:
Nick Sweeting 2021-07-01 21:40:10 -04:00 committed by GitHub
commit f6aad7f9a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,6 +11,8 @@ from django.views.generic.list import ListView
from django.views.generic import FormView
from django.db.models import Q
from django.contrib.auth.mixins import UserPassesTestMixin
from django.views.decorators.csrf import csrf_exempt
from django.utils.decorators import method_decorator
from core.models import Snapshot
from core.forms import AddLinkForm
@ -236,7 +238,7 @@ class PublicIndexView(ListView):
else:
return redirect(f'/admin/login/?next={self.request.path}')
@method_decorator(csrf_exempt, name='dispatch')
class AddView(UserPassesTestMixin, FormView):
template_name = "add.html"
form_class = AddLinkForm