changed updateIp to detectIP
This commit is contained in:
parent
2e0f02053f
commit
374288d20a
@ -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'
|
||||
|
@ -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),
|
||||
)
|
||||
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user