django-utils

personal collection of django utilities
git clone https://git.ce9e.org/django-utils.git

commit
03515a015e1ef6cce1c4547760d2358a9e09c6a8
parent
6ac318305cd2080b3f6038ce38b75030a02503b3
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2019-09-15 08:46
rm NextMixin

Diffstat

D utils/next.py 20 --------------------

1 files changed, 0 insertions, 20 deletions


diff --git a/utils/next.py b/utils/next.py

@@ -1,20 +0,0 @@
    1    -1 from django.utils.http import is_safe_url
    2    -1 
    3    -1 
    4    -1 class NextMixin:
    5    -1     redirect_field_name = 'next'
    6    -1 
    7    -1     def get_success_url(self):
    8    -1         redirect_to = self.request.POST.get(
    9    -1             self.redirect_field_name,
   10    -1             self.request.GET.get(self.redirect_field_name))
   11    -1         if not redirect_to:
   12    -1             if self.success_url is not None:
   13    -1                 redirect_to = self.success_url
   14    -1             elif self.object:
   15    -1                 redirect_to = self.object.get_absolute_url()
   16    -1         host = self.request.get_host()
   17    -1         if redirect_to and is_safe_url(redirect_to, allowed_hosts={host}):
   18    -1             return redirect_to
   19    -1         else:
   20    -1             return ''