2019-01-29 22:56:51 +00:00
|
|
|
from urllib.parse import urlsplit
|
|
|
|
|
|
|
|
from django.views.generic import TemplateView
|
2019-01-27 13:26:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Create your views here.
|
|
|
|
|
2019-01-29 22:56:51 +00:00
|
|
|
class IndexView(TemplateView):
|
|
|
|
template_name = 'no_ipv4_here/index.html'
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs):
|
|
|
|
context = super(IndexView, self).get_context_data(**kwargs)
|
|
|
|
back_to_url = ""
|
|
|
|
if "back_to" in self.request.GET:
|
|
|
|
back_to_url = self.request.GET["back_to"]
|
|
|
|
elif 'HTTP_HOST' in self.request.META:
|
|
|
|
back_to_url = self.request.META['HTTP_HOST']
|
|
|
|
context['back_to_url'] = back_to_url
|
|
|
|
if back_to_url != "":
|
|
|
|
context['domain'] = (urlsplit(back_to_url)).netloc
|
|
|
|
return context
|