diff --git a/no_ipv4_here/views.py b/no_ipv4_here/views.py index a587aa7..522a581 100644 --- a/no_ipv4_here/views.py +++ b/no_ipv4_here/views.py @@ -1,13 +1,21 @@ -from django.contrib.sites.shortcuts import get_current_site from django.http import HttpResponse # Create your views here. def index(request): - return HttpResponse( - """Sorry, (this part of) domain {domain} is not reachable by IPv4. - Please upgrade to IPv6 and try to reach {domain} again.""".format( - domain=get_current_site(request).domain + back_to_url = "" + if "back_to" in request.GET: + back_to_url = request.GET["back_to"] + if back_to_url != "": + return HttpResponse( + """Sorry, this part of domain 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.""" ) - )