Browse Source

Signed-off-by: zry <admin@z-touhou.org>

zry 8 years ago
parent
commit
6d33a8180c
4 changed files with 87 additions and 3 deletions
  1. 21 2
      templates/sidebar.html
  2. 57 0
      templates/vote/contestant.list.html
  3. 2 0
      vote/urls.py
  4. 7 1
      vote/views.py

+ 21 - 2
templates/sidebar.html

@@ -47,6 +47,25 @@
     </table>
 </div>
 
+<div class="panel panel-primary">
+    <div class="panel-heading">
+        <h4 class="panel-title">
+            <span class="glyphicon glyphicon-flag btn-xs"></span>
+            活动管理
+        </h4>
+    </div>
+    <table class="table">
+        <tbody>
+            <tr>
+                <td>
+                    <span class="glyphicon glyphicon-tags btn-xs"></span>
+                    <a href="{% url 'contestantslist' %}">参赛人员管理</a>
+                </td>
+            </tr>
+        </tbody>
+    </table>
+</div>
+
 <div class="panel panel-primary">
     <div class="panel-heading">
         <h4 class="panel-title">
@@ -58,13 +77,13 @@
         <tbody>
             <tr>
                 <td>
-                    <span class=" glyphicon glyphicon-repeat btn-xs"></span>
+                    <span class="glyphicon glyphicon-repeat btn-xs"></span>
                     <a href="{% url 'sys_restart' %}">重新开始</a>
                 </td>
             </tr>
             <tr>
                 <td>
-                    <span class=" glyphicon glyphicon-random btn-xs"></span>
+                    <span class="glyphicon glyphicon-random btn-xs"></span>
                     <a href="{% url 'xlspasswdurl' %}">随机密码工具</a>
                 </td>
             </tr>

+ 57 - 0
templates/vote/contestant.list.html

@@ -0,0 +1,57 @@
+{% extends "base.html" %}
+
+{% block title %}
+    参赛选手列表
+{% endblock %}
+
+{% block content %}
+    <div class="section section-breadcrumbs section-breadcrumbs-backend">
+        <div class="container">
+            <div class="row">
+                <div class="col-md-12">
+                    <h1>参赛选手列表</h1>
+                </div>
+            </div>
+        </div>
+    </div>
+<!--     <div class="btn-toolbar">
+        <div class="btn-group">
+            {% url "listuserurl" as thelistuserurl %}
+            <a class="btn btn-default {%if request.path = thelistuserurl%} active {%endif%}" href={{ thelistuserurl }}><span class="glyphicon glyphicon-list"></span>用户列表</a>
+            {% url "removesusersurl" as theremovesusersurl %}
+            <a class="btn btn-default {%if request.path = theremovesusersurl%} active {%endif%}" href={{ theremovesusersurl }}><span class="glyphicon glyphicon-list"></span>批量删除</a>
+        </div>
+    </div> -->
+
+    <hr/>
+
+    {{FilterHTML|safe}}
+
+    <table class="table table-hover table-striped  table-bordered table-condensed">
+        <tr>
+            <th>账号</th>
+            <th>姓名</th>
+            <th>性别</th>
+            <th>学号</th>
+            <th>分组</th>
+            <th>操作</th>
+        </tr>
+
+            {% for i in lPage %}
+                <tr style="font-size: 13px;">
+                    <td>{{ i.username }}</td>
+                    <td>{{ i.nickname|default:"----" }}</td>
+                    <td>{{ i.sex|default:"----" }}</td>
+                    <td>{{ i.sid }}</td>
+                    <td>{{ i.classid }}</td>
+                    <td class="host_buttom">
+                        <a class="btn btn-danger btn-xs" href={% url "deletecturl" i.id %} onclick="return confirm('是否确认删除?')">删除</a>
+                    </td>
+                </tr>
+            {% endfor %}
+
+        </table>
+
+    {% include "common/paginator.html" %}
+
+{% endblock %}

+ 2 - 0
vote/urls.py

@@ -2,4 +2,6 @@ from django.conf.urls import patterns, include, url
 
 urlpatterns = patterns('vote.views',
     url(r'^system/restart/$', 'sysRestart', name='sys_restart'),
+    url(r'^contestant/list/$', 'ListContestants', name='contestantslist'),
+    url(r'^contestant/delete/(?P<ID>\d+)/$', 'DeleteContestant', name='deletecturl'),
 )

+ 7 - 1
vote/views.py

@@ -1,3 +1,4 @@
+# -*- coding: UTF-8 -*-
 from django.core.urlresolvers import reverse
 from django.http import HttpResponse,HttpResponseRedirect
 from django.shortcuts import render_to_response,RequestContext
@@ -27,7 +28,7 @@ def ListContestants(request):
 	fco = FilterCondition()
 	fco.addTextContain("sid","参赛者用户名","user__sid")
 	fco.addTextContain("nick","参赛者姓名","user__nickname")
-	fco.addTextContain("nick","作品ID","user__nickname")
+	fco.addTextContain("nick","作品ID","works_set__uuid")
 	fco.addMultiChoice("class","组别","classid__name",allclass)
 	
 	fList = CommonFilter(request,fco,mList)
@@ -42,5 +43,10 @@ def ListContestants(request):
 
 	return render_to_response('vote/contestant.list.html',kwvars,RequestContext(request))
 
+def DeleteContestant(request,ID):
+	cobj = Contestants.objects.get(id=ID)
+	cobj.works_set.all().delete()
+	cobj.delete()
+	return HttpResponseRedirect(reverse('contestantslist'))
 
 # Create your views here.