From 6d545565f600ac60332d14846d3e0be85126bbe7 Mon Sep 17 00:00:00 2001 From: guanghongwei Date: Sat, 24 Jan 2015 12:54:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- juser/views.py | 15 ++- templates/juser/group_list.html | 163 ++++++++++++++++++++------------ templates/juser/user_list2.html | 80 ---------------- 3 files changed, 115 insertions(+), 143 deletions(-) delete mode 100644 templates/juser/user_list2.html diff --git a/juser/views.py b/juser/views.py index ca34d7b0f..102431ef9 100644 --- a/juser/views.py +++ b/juser/views.py @@ -147,8 +147,19 @@ def group_add(request): def group_list(request): - header_title, path1, path2 = '查看属组 | Add Group', 'juser', 'group_list' - groups = UserGroup.objects.all() + header_title, path1, path2 = '查看属组 | Show Group', 'juser', 'group_list' + groups = contact_list = UserGroup.objects.all().order_by('id') + p = paginator = Paginator(contact_list, 10) + + try: + page = int(request.GET.get('page', '1')) + except ValueError: + page = 1 + + try: + contacts = paginator.page(page) + except (EmptyPage, InvalidPage): + contacts = paginator.page(paginator.num_pages) return render_to_response('juser/group_list.html', locals()) diff --git a/templates/juser/group_list.html b/templates/juser/group_list.html index 19eedb3d1..2e627ed18 100644 --- a/templates/juser/group_list.html +++ b/templates/juser/group_list.html @@ -1,71 +1,112 @@ {% extends 'base.html' %} - +{% load mytags %} {% block content %} - {% include 'nav_cat_bar.html' %} -
-
-
-
-
-
属组信息 show group info.
- +{% include 'nav_cat_bar.html' %} + +
+
+
+
+
+
查看分组 show group info.
+ +
+ +
+ -
-
- - - - - - - - - - - {% for group in groups %} - - - - - - - {% endfor %} - -
-
- -
-
ID组名备注
-
- -
-
{{ group.id }}{{ group.name }}{{ group.comment }}
-
-
- - -
+ + + + + + + + + + + + + {% for group in contacts.object_list %} + + + + + + + + {% endfor %} + +
ID组名备注操作
{{ group.id }} {{ group.name }} {{ user.comment }} + 详情 + 编辑 + 删除 +
+
+
+
+ Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.count }} entries +
+
+
+
+
    + {% if contacts.has_previous %} + + {% else %} + + {% endif %} + {% for page in p.page_range %} + {% ifequal offset1 page %} +
  • {{ page }}
  • + {% else %} +
  • {{ page }}
  • + {% endifequal %} + {% endfor %} + {% if contacts.has_next %} + + {% else %} + + {% endif %} +
- +
+
+ + + {% endblock %} \ No newline at end of file diff --git a/templates/juser/user_list2.html b/templates/juser/user_list2.html deleted file mode 100644 index 9c30bb01f..000000000 --- a/templates/juser/user_list2.html +++ /dev/null @@ -1,80 +0,0 @@ -{% extends 'base.html' %} -{% load mytags %} - -{% block content %} - {% include 'nav_cat_bar.html' %} -
-
-
-
-
-
用户信息 show user info.
- -
-
-
- - - - - - - - - - - - - - - {% for user in users %} - - - - - - - - - - - {% endfor %} - -
-
- -
-
ID用户名姓名属组角色Email激活
-
- -
-
{{ user.id }}{{ user.username }}{{ user.name }}{{ user.username|groups_str }}{{ user.id|get_role }}{{ user.email }}{{ user.is_active }}
-
-
- - -
-
-
-
-
-
-
-
-{% endblock %} \ No newline at end of file