Use back_to GET parameter to create a link

This commit is contained in:
PCoder 2019-01-27 15:34:50 +01:00
parent 6cc71fe82a
commit c098d7a497

View file

@ -1,13 +1,21 @@
from django.contrib.sites.shortcuts import get_current_site
from django.http import HttpResponse from django.http import HttpResponse
# Create your views here. # Create your views here.
def index(request): def index(request):
return HttpResponse( back_to_url = ""
"""Sorry, (this part of) domain {domain} is not reachable by IPv4. if "back_to" in request.GET:
Please upgrade to IPv6 and try to reach {domain} again.""".format( back_to_url = request.GET["back_to"]
domain=get_current_site(request).domain if back_to_url != "":
return HttpResponse(
"""Sorry, <a href="{domain}">this part of domain</a> is not reachable by IPv4.
Please upgrade to IPv6 and try to reach {domain} again.""".format(
domain=back_to_url
)
)
else:
return HttpResponse(
"""Sorry, this part of domain is not reachable by IPv4.
Please upgrade to IPv6 and try to reach the domain again."""
) )
)