添加删除用户

pull/6/head
ibuler 10 years ago
parent 7e41f28864
commit 6b2310ff38

@ -178,6 +178,15 @@ def user_detail(request):
return render_to_response('juser/user_detail.html', locals())
def user_del(request):
username = request.GET.get('username', None)
if not username:
return HttpResponseRedirect('/')
user = User.objects.get(username=username)
user.delete()
return HttpResponseRedirect('/juser/user_list/', locals())
def db_add_user(**kwargs):
groups_post = kwargs.pop('groups')
user = User(**kwargs)

@ -59,9 +59,9 @@
<td class="text-center">{{ user.email }}</td>
<td class="text-center">{{ user.is_active|bool2str }}</td>
<td class="text-center">
<a href="../user_detail/?{{ user.username }}/" class="iframe btn btn-xs btn-primary">详情</a>
<a href="../user_edit/{{ user.username }}" class="btn btn-xs btn-info">编辑</a>
<a href="../user_del/{{ user.username }}" class="btn btn-xs btn-danger">删除</a>
<a href="../user_detail/?username={{ user.username }}/" class="iframe btn btn-xs btn-primary">详情</a>
<a href="../user_edit/?username={{ user.username }}" class="btn btn-xs btn-info">编辑</a>
<a href="../user_del/?username={{ user.username }}" class="btn btn-xs btn-danger">删除</a>
</td>
</tr>
{% endfor %}

Loading…
Cancel
Save