changed updateIp to detectIP

This commit is contained in:
Fabian Faessler 2013-09-29 02:07:58 +02:00
parent 2e0f02053f
commit 374288d20a
3 changed files with 6 additions and 6 deletions

View File

@ -6,8 +6,8 @@ logger = logging.getLogger(__name__)
from django.http import HttpResponse
from django.conf import settings
from django.contrib.auth.hashers import check_password
from django.contrib.auth.decorators import login_required
from main.forms import *
from main.models import Host
import dns.inet
import os
@ -19,7 +19,7 @@ def MyIpView(request):
return HttpResponse(request.META['REMOTE_ADDR'], content_type="text/plain")
def UpdateIpView(request):
def DetectIpView(request):
ipaddr = request.META['REMOTE_ADDR']
af = dns.inet.af_for_address(ipaddr)
key = 'ipv4' if af == dns.inet.AF_INET else 'ipv6'

View File

@ -3,7 +3,7 @@ from main.views import (
HomeView, OverviewView, HostView, DeleteHostView,
)
from api.views import (
MyIpView, UpdateIpView, NicUpdateView
MyIpView, DetectIpView, NicUpdateView
)
urlpatterns = patterns('',
@ -12,6 +12,6 @@ urlpatterns = patterns('',
url(r'^host/(?P<pk>\d+)/$', HostView.as_view(), name='host_view'),
url(r'^host/(?P<pk>\d+)/delete/$', DeleteHostView.as_view(), name='delete_host'),
url(r'^myip$', MyIpView),
url(r'^updateip$', UpdateIpView),
url(r'^detectip$', DetectIpView),
url(r'^nic/update$', NicUpdateView),
)

View File

@ -124,8 +124,8 @@
</div>
<div style="display: none">
<img src="//{{ WWW_IPV4_HOST }}/updateip" />
<img src="//{{ WWW_IPV6_HOST }}/updateip" />
<img src="//{{ WWW_IPV4_HOST }}/detectip" />
<img src="//{{ WWW_IPV6_HOST }}/detectip" />
</div>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>