Merge branch 'master' of github.com:asmaps/nsupdate.info
This commit is contained in:
commit
4fb3976ac3
@ -1,6 +1,7 @@
|
|||||||
from django.conf.urls import patterns, include, url
|
from django.conf.urls import patterns, include, url
|
||||||
from main.views import HomeView
|
from main.views import HomeView, MyIpView
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
url(r'^$', HomeView.as_view(), name="home"),
|
url(r'^$', HomeView.as_view(), name="home"),
|
||||||
|
url(r'^myip/', MyIpView)
|
||||||
)
|
)
|
||||||
|
@ -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
|
||||||
|
import json
|
||||||
|
|
||||||
class HomeView(TemplateView):
|
class HomeView(TemplateView):
|
||||||
template_name = "base.html"
|
template_name = "base.html"
|
||||||
@ -9,3 +10,6 @@ class HomeView(TemplateView):
|
|||||||
context = super(HomeView, self).get_context_data(*args, **kwargs)
|
context = super(HomeView, self).get_context_data(*args, **kwargs)
|
||||||
context['nav_home'] = True
|
context['nav_home'] = True
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
def MyIpView(request):
|
||||||
|
return HttpResponse(json.dumps({'ip':request.META['REMOTE_ADDR']}), content_type="application/json")
|
Loading…
x
Reference in New Issue
Block a user