used the url from the settings for the ajax request

This commit is contained in:
Fabian Faessler 2013-09-28 16:25:19 +02:00
parent de67505991
commit a2a5f8e7f8
2 changed files with 7 additions and 4 deletions

View File

@ -4,8 +4,8 @@
<script> <script>
getIp = function(protocol) { getIp = function(domain,protocol) {
$.getJSON('http://www.ip'+protocol+'.nsupdate.info/myip?callback=?','',function(json_data){ $.getJSON('http://'+domain+'/myip?callback=?','',function(json_data){
$(".ip"+protocol+"adr").val(json_data.ip); $(".ip"+protocol+"adr").val(json_data.ip);
}).fail(function() { }).fail(function() {
$(".ip"+protocol+"adr").val("no ip"+protocol+" address found"); $(".ip"+protocol+"adr").val("no ip"+protocol+" address found");
@ -13,8 +13,8 @@
} }
$(document).ready(function() { $(document).ready(function() {
getIp('v4'); getIp('{{ ipv4 }}','v4');
getIp('v6'); getIp('{{ ipv6 }}','v6');
}); });
</script> </script>

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.views.generic import TemplateView from django.views.generic import TemplateView
from django.http import HttpResponse from django.http import HttpResponse
from django.conf import settings
import json import json
class HomeView(TemplateView): class HomeView(TemplateView):
@ -17,6 +18,8 @@ class OverviewView(TemplateView):
def get_context_data(self, *args, **kwargs): def get_context_data(self, *args, **kwargs):
context = super(OverviewView, self).get_context_data(*args, **kwargs) context = super(OverviewView, self).get_context_data(*args, **kwargs)
context['nav_overview'] = True context['nav_overview'] = True
context['ipv4'] = settings.WWW_IPV4_HOST
context['ipv6'] = settings.WWW_IPV6_HOST
return context return context