Merge remote-tracking branch 'origin/master'

This commit is contained in:
自由的飞翔 2018-12-28 21:52:37 +08:00
commit 79041c8fe6
3 changed files with 26 additions and 19 deletions

View File

@ -75,24 +75,24 @@
</ul>
</li>
{# <li {% if url_name|startswith:'disaster' %}class="active"{% endif %}>#}
{# <a href="#">#}
{# <i class="fa fa-th-large"></i>#}
{# <span class="nav-label">灾害预测</span>#}
{# <span class="fa arrow"></span>#}
{# </a>#}
{# <ul class="nav nav-second-level collapse">#}
{# <li {% if url_name == 'disaster-index' %}class="active"{% endif %}>#}
{# <a href="{% url 'disaster-index' %}">干旱预测</a>#}
{# </li>#}
{# <li {% if url_name == '' %}class="active"{% endif %}>#}
{# <a href="#">暴雨风险预测</a>#}
{# </li>#}
{# <li {% if url_name == 'disaster-hail' %}class="active"{% endif %}>#}
{# <a href="{% url 'disaster-hail' %}">冰雹风险预测</a>#}
{# </li>#}
{# </ul>#}
{# </li>#}
<li {% if url_name|startswith:'disaster' %}class="active"{% endif %}>
<a href="#">
<i class="fa fa-th-large"></i>
<span class="nav-label">灾害预测</span>
<span class="fa arrow"></span>
</a>
<ul class="nav nav-second-level collapse">
<li {% if url_name == 'disaster-index' %}class="active"{% endif %}>
<a href="{% url 'disaster-index' %}">干旱预测</a>
</li>
<li {% if url_name == '' %}class="active"{% endif %}>
<a href="#">暴雨风险预测</a>
</li>
<li {% if url_name == 'disaster-hail' %}class="active"{% endif %}>
<a href="{% url 'disaster-hail' %}">冰雹风险预测</a>
</li>
</ul>
</li>
<li {% if url_name|startswith:'policy' %}class="active"{% endif %}>
<a href="#">

View File

@ -4,6 +4,7 @@ from users import views
urlpatterns = [
path('status', views.server_status, name='server-status'),
path('status/proxy', views.server_status_proxy, name='server-status-proxy'),
path('list/',views.UserListView.as_view(),name = 'user-list'),
path('detail/',views.UserDetailView.as_view(),name = 'user-detail'),
]

View File

@ -1,5 +1,6 @@
import requests
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.shortcuts import render
# Create your views here.
@ -7,8 +8,12 @@ from django.views.generic import ListView, DetailView
def server_status(request):
return render(request, 'user/status.html')
def server_status_proxy(request):
r = requests.get('http://127.0.0.1/server-status')
return render(request, 'user/status.html', {'text', r.text})
return HttpResponse(r.text)
class UserListView(ListView):
@ -16,6 +21,7 @@ class UserListView(ListView):
context_object_name = 'user'
template_name = 'user/user_list.html'
class UserDetailView(DetailView):
model = User
context_object_name = 'user'