#更改数据库
This commit is contained in:
parent
66a0d92483
commit
310a8a7024
|
@ -121,7 +121,7 @@
|
|||
<option value="{{ group.classify }}">行业</option>
|
||||
{% endif %}
|
||||
{% for g in g_c_c_res %}
|
||||
<option value="{{ g }}">{{ g }}</option>
|
||||
<option value="{{ g.0 }}">{{ g.1 }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
@ -1,119 +1,162 @@
|
|||
{% extends 'dashboard/base/base.html' %}
|
||||
{% load static %}
|
||||
{% block content %}
|
||||
<body class=" ">
|
||||
<!-- START TOPBAR -->
|
||||
|
||||
<!-- START CONTAINER -->
|
||||
<div class="page-container row-fluid">
|
||||
|
||||
<div class="page-sidebar ">
|
||||
{% include 'dashboard/base/left.html' %}
|
||||
</div>
|
||||
<section id="main-content" class=" ">
|
||||
<section class="wrapper" style='margin-top:60px;display:inline-block;width:100%;padding:15px 0 0 15px;'>
|
||||
{% if messages %}
|
||||
<div class="alert alert-success alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert">
|
||||
<span aria-hidden="true">×</span>
|
||||
<span class="sr-only">Close</span>
|
||||
</button>
|
||||
{% for message in messages %}
|
||||
{{ message }}.<br/>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class='col-lg-12 col-md-12 col-sm-12 col-xs-12'>
|
||||
<div class="page-title">
|
||||
|
||||
<div class="pull-left">
|
||||
<h1 class="title">系统设置</h1></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<div class="col-lg-12 col-md-12 col-xs-12 col-sm-12">
|
||||
<section class="box ">
|
||||
<header class="panel_header">
|
||||
<h2 class="title pull-left">用户信息</h2>
|
||||
</header>
|
||||
<div class="content-body">
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-sm-9 col-xs-10">
|
||||
<form method="post"
|
||||
action="{% url 'user-management-update' usee.id %}"
|
||||
enctype="multipart/form-data">{% csrf_token %}
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="organization">单位</label>
|
||||
<div class="controls">
|
||||
<select class="form-control" name="organization">
|
||||
<option value="{{ userprofile.organization.id }}">{{ userprofile.organization.name }}</option>
|
||||
{% for o in organization %}
|
||||
<option value="{{ o.id }}">{{ o.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="name">姓名</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="form-control" name="name"
|
||||
value="{{ userprofile.name }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="email">邮箱</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="form-control" name="email"
|
||||
value="{{ usee.email }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="username">电话</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="form-control" name="username"
|
||||
value="{{ usee.username }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="image">图标
|
||||
<div class="controls">
|
||||
<input type="file" name="image"><img
|
||||
src="{{ userprofile.image.url }}"
|
||||
style="width: 80px;height: 80px;"
|
||||
class="img-circle">
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="passwordold">旧密码<br/>
|
||||
<input type="password" name="passwordold" id="user_pass" class="input"
|
||||
value="" size="20"/></label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="passwordnew">新密码<br/>
|
||||
<input type="password" name="passwordnew" id="user_pass" class="input"
|
||||
value="" size="20"/></label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="confirm_password">确认密码<br/>
|
||||
<input type="password" name="confirm_password" id="user_pass1"
|
||||
class="input" value=""
|
||||
size="20"/></label>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" style="margin-top: 50px">提交修改
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
<div class="chatapi-windows "></div>
|
||||
</div>
|
||||
</body>
|
||||
{% endblock %}
|
||||
|
||||
{% extends 'dashboard/base/base.html' %}
|
||||
{% load static %}
|
||||
{% block content %}
|
||||
<body class=" ">
|
||||
<!-- START TOPBAR -->
|
||||
|
||||
<!-- START CONTAINER -->
|
||||
<div class="page-container row-fluid">
|
||||
|
||||
<div class="page-sidebar ">
|
||||
{% include 'dashboard/base/left.html' %}
|
||||
</div>
|
||||
<section id="main-content" class=" ">
|
||||
<section class="wrapper" style='margin-top:60px;display:inline-block;width:100%;padding:15px 0 0 15px;'>
|
||||
{% if messages %}
|
||||
<div class="alert alert-success alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert">
|
||||
<span aria-hidden="true">×</span>
|
||||
<span class="sr-only">Close</span>
|
||||
</button>
|
||||
{% for message in messages %}
|
||||
{{ message }}.<br/>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class='col-lg-12 col-md-12 col-sm-12 col-xs-12'>
|
||||
<div class="page-title">
|
||||
|
||||
<div class="pull-left">
|
||||
<h1 class="title">系统设置</h1></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<div class="col-lg-12 col-md-12 col-xs-12 col-sm-12">
|
||||
<section class="box ">
|
||||
<header class="panel_header">
|
||||
<h2 class="title pull-left">用户信息</h2>
|
||||
</header>
|
||||
<div class="content-body">
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-sm-9 col-xs-10">
|
||||
<form method="post"
|
||||
action="{% url 'user-management-update' usee.id %}"
|
||||
enctype="multipart/form-data">{% csrf_token %}
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="organization">单位</label>
|
||||
{# <div class="controls">#}
|
||||
{# <select class="form-control" name="organization">#}
|
||||
{# <option value="{{ userprofile.organization.id }}">{{ userprofile.organization.name }}</option>#}
|
||||
{# {% for o in organization %}#}
|
||||
{# <option value="{{ o.id }}">{{ o.name }}</option>#}
|
||||
{# {% endfor %}#}
|
||||
{# </select>#}
|
||||
|
||||
{# </div>#}
|
||||
<div class="input-group main-search">
|
||||
<input type="text" class="form-control" placeholder="请输入关键字"
|
||||
style="height: 40px;width: 985px;opacity: .9 "
|
||||
name="organization" value="{{ userprofile.organization.name }}">
|
||||
<div class="input-group-btn" style="display: none">
|
||||
<button class="btn btn-default" type="button">
|
||||
<span class="glyphicon glyphicon-search"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="autocomplete-panel" style="z-index: 9999">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="name">姓名</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="form-control" name="name"
|
||||
value="{{ userprofile.name }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="email">邮箱</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="form-control" name="email"
|
||||
value="{{ usee.email }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="username">电话</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="form-control" name="username"
|
||||
value="{{ usee.username }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="image">图标
|
||||
<div class="controls">
|
||||
<input type="file" name="image"><img
|
||||
src="{{ userprofile.image.url }}"
|
||||
style="width: 80px;height: 80px;"
|
||||
class="img-circle">
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="passwordold">旧密码<br/>
|
||||
<input type="password" name="passwordold" id="user_pass" class="input"
|
||||
value="" size="20"/></label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="passwordnew">新密码<br/>
|
||||
<input type="password" name="passwordnew" id="user_pass" class="input"
|
||||
value="" size="20"/></label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="confirm_password">确认密码<br/>
|
||||
<input type="password" name="confirm_password" id="user_pass1"
|
||||
class="input" value=""
|
||||
size="20"/></label>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary" style="margin-top: 50px">提交修改
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
<div class="chatapi-windows "></div>
|
||||
</div>
|
||||
</body>
|
||||
{% endblock %}
|
||||
{% block add_js %}
|
||||
<script>
|
||||
$(function () {
|
||||
$('.main-search input').focus(function (e) {
|
||||
e.preventDefault();
|
||||
$("#history_query").hide()
|
||||
var width = $(this).width();
|
||||
var position = $(this).position();
|
||||
var val = $(this).val();
|
||||
var params = {keyword: val}
|
||||
if (val) {
|
||||
$('.autocomplete-panel').load('/get/organization/' + '?' + $.param(params));
|
||||
}
|
||||
$('.autocomplete-panel').css({
|
||||
width: width + 12,
|
||||
top: position.top + 34,
|
||||
left: position.left + 5
|
||||
}).show();
|
||||
}).blur(function (e) {
|
||||
e.preventDefault();
|
||||
}).on('input', function (e) {
|
||||
var val = $(this).val();
|
||||
var params = {keyword: val}
|
||||
$('.autocomplete-panel').load('/get/organization/' + '?' + $.param(params))
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -52,8 +52,8 @@ def user_management(request):
|
|||
print(organization_id)
|
||||
if Organization.objects.get(id=organization_id).province and Organization.objects.get(
|
||||
id=organization_id).cities and Organization.objects.get(
|
||||
id=organization_id).district and Organization.objects.get(
|
||||
id=organization_id).town and Organization.objects.get(id=organization_id).village:
|
||||
id=organization_id).district and Organization.objects.get(
|
||||
id=organization_id).town and Organization.objects.get(id=organization_id).village:
|
||||
o['administrativedivision'] = str(str(
|
||||
Area_code_2020.objects.get(code=Organization.objects.get(id=organization_id).province)) + '-' + str(
|
||||
Area_code_2020.objects.get(code=Organization.objects.get(id=organization_id).cities)) + '-' + str(
|
||||
|
@ -63,7 +63,7 @@ def user_management(request):
|
|||
'None', '')
|
||||
elif Organization.objects.get(id=organization_id).province and Organization.objects.get(
|
||||
id=organization_id).cities and Organization.objects.get(
|
||||
id=organization_id).district and Organization.objects.get(id=organization_id).town:
|
||||
id=organization_id).district and Organization.objects.get(id=organization_id).town:
|
||||
o['administrativedivision'] = str(str(
|
||||
Area_code_2020.objects.get(code=Organization.objects.get(id=organization_id).province)) + '-' + str(
|
||||
Area_code_2020.objects.get(code=Organization.objects.get(id=organization_id).cities)) + '-' + str(
|
||||
|
@ -106,7 +106,8 @@ def user_update(request, pk):
|
|||
userprofile = Userprofile.objects.get(user_id=user.id)
|
||||
organization = Organization.objects.filter(status='1')
|
||||
if request.method == 'POST':
|
||||
organization_id = request.POST.get('organization')
|
||||
o = request.POST.get('organization')
|
||||
o_id = Organization.objects.get(name=o).id
|
||||
name = request.POST.get('name')
|
||||
email = request.POST.get('email')
|
||||
username = request.POST.get('username')
|
||||
|
@ -120,7 +121,7 @@ def user_update(request, pk):
|
|||
user.email = email
|
||||
user.username = username
|
||||
user.password = make_password(passwordnew)
|
||||
userprofile.organization_id = organization_id
|
||||
userprofile.organization_id = o_id
|
||||
userprofile.name = name
|
||||
if image is not None:
|
||||
userprofile.image = image
|
||||
|
@ -134,7 +135,7 @@ def user_update(request, pk):
|
|||
else:
|
||||
user.email = email
|
||||
user.username = username
|
||||
userprofile.organization_id = organization_id
|
||||
userprofile.organization_id = o_id
|
||||
userprofile.name = name
|
||||
if image is not None:
|
||||
userprofile.image = image
|
||||
|
@ -259,7 +260,7 @@ def group_update(request, pk):
|
|||
GROUP_CLASSIFY_CHOICES = Group.GROUP_CLASSIFY_CHOICES
|
||||
g_c_c_res = []
|
||||
for g_c_c in GROUP_CLASSIFY_CHOICES:
|
||||
g_c_c_res.append(list(g_c_c)[1])
|
||||
g_c_c_res.append([list(g_c_c)[0], list(g_c_c)[1]])
|
||||
group_type = Group_type.objects.all()
|
||||
group_admin = Group_admin.objects.filter(group_id=pk)
|
||||
print(pk)
|
||||
|
@ -271,8 +272,26 @@ def group_update(request, pk):
|
|||
o['username'] = g_a.user.username
|
||||
o['name'] = Userprofile.objects.get(user_id=g_a.user.id).name
|
||||
o['organization'] = Userprofile.objects.get(user_id=g_a.user.id).organization.name
|
||||
o['administrativedivision'] = str(g_a.group.province) + '-' + str(g_a.group.cities) + '-' + str(
|
||||
g_a.group.district) + '-' + str(g_a.group.town) + '-' + str(g_a.group.village)
|
||||
if g_a.group.province and g_a.group.cities and g_a.group.district and g_a.group.town and g_a.group.village:
|
||||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.cities).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.district).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.town).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.village).name)
|
||||
elif g_a.group.province and g_a.group.cities and g_a.group.district and g_a.group.town:
|
||||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.cities).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.district).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.town).name)
|
||||
elif g_a.group.province and g_a.group.cities and g_a.group.district:
|
||||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.cities).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.district).name)
|
||||
elif g_a.group.province and g_a.group.cities:
|
||||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.cities).name)
|
||||
elif g_a.group.province:
|
||||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name)
|
||||
g_a_list.append(o)
|
||||
group_user = Group_user.objects.filter(group_id=pk)
|
||||
g_u_list = []
|
||||
|
@ -283,8 +302,26 @@ def group_update(request, pk):
|
|||
i['username'] = g_u.user.username
|
||||
i['name'] = Userprofile.objects.get(user_id=g_u.user.id).name
|
||||
i['organization'] = Userprofile.objects.get(user_id=g_u.user.id).organization.name
|
||||
i['administrativedivision'] = str(g_u.group.province) + '-' + str(g_u.group.cities) + '-' + str(
|
||||
g_u.group.district) + '-' + str(g_u.group.town) + '-' + str(g_u.group.village)
|
||||
if g_u.group.province and g_u.group.cities and g_u.group.district and g_u.group.town and g_u.group.village:
|
||||
i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.cities).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.district).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.town).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.village).name)
|
||||
elif g_u.group.province and g_u.group.cities and g_u.group.district and g_u.group.town:
|
||||
i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.cities).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.district).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.town).name)
|
||||
elif g_u.group.province and g_u.group.cities and g_u.group.district:
|
||||
i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.cities).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.district).name)
|
||||
elif g_u.group.province and g_u.group.cities:
|
||||
i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.cities).name)
|
||||
elif g_u.group.province:
|
||||
i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name)
|
||||
g_u_list.append(i)
|
||||
if request.method == 'POST':
|
||||
name = request.POST.get('name')
|
||||
|
@ -613,8 +650,18 @@ def organization_update(request, pk):
|
|||
|
||||
|
||||
def organization_create(request):
|
||||
organizationtype = Organizationtype.objects.all()
|
||||
level = Level.objects.all()
|
||||
user = request.user
|
||||
l = Userprofile.objects.get(user_id=user.id).organization.level.level
|
||||
if user.is_superuser:
|
||||
level = Level.objects.filter(level__in=[1, 2, 3, 5, 0])
|
||||
elif l == '1':
|
||||
level = Level.objects.filter(level__in=[2, 3, 5, 0])
|
||||
elif l == '2':
|
||||
level = Level.objects.filter(level__in=[3, 5, 0])
|
||||
elif l == '3':
|
||||
level = Level.objects.filter(level__in=[5, 0])
|
||||
else:
|
||||
level = Level.objects.filter(level__in=[0])
|
||||
if request.method == 'POST':
|
||||
name = request.POST.get('name')
|
||||
image = None
|
||||
|
@ -650,7 +697,7 @@ def organization_create(request):
|
|||
messages.error(request, '单位名不能为空')
|
||||
return HttpResponseRedirect('/management/organization/create/')
|
||||
return render(request, 'management/organization-management-create.html',
|
||||
{'organizationtype': organizationtype, 'level': level})
|
||||
{'level': level})
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -1408,8 +1455,8 @@ def newmedia_management_update_douyin(request, pk):
|
|||
if image is not None:
|
||||
Douyin.objects.filter(id=pk).update(code=code, douyinid=douyinid, alias=alias,
|
||||
organization_id=o_id, status=status,
|
||||
identificationcode=identificationcode, function=function,
|
||||
articleurl=articleurl)
|
||||
identificationcode=identificationcode, function=function,
|
||||
articleurl=articleurl)
|
||||
douyin.image = image
|
||||
douyin.save()
|
||||
messages.success(request, '修改成功')
|
||||
|
@ -1417,8 +1464,8 @@ def newmedia_management_update_douyin(request, pk):
|
|||
else:
|
||||
Douyin.objects.filter(id=pk).update(code=code, douyinid=douyinid, alias=alias,
|
||||
organization_id=o_id, status=status,
|
||||
identificationcode=identificationcode, function=function,
|
||||
articleurl=articleurl)
|
||||
identificationcode=identificationcode, function=function,
|
||||
articleurl=articleurl)
|
||||
messages.success(request, '修改成功')
|
||||
return HttpResponseRedirect('/management/newmedia/management/edit/douyin/')
|
||||
else:
|
||||
|
@ -1460,8 +1507,8 @@ def newmedia_management_update_qita(request, pk):
|
|||
if image is not None:
|
||||
Qita.objects.filter(id=pk).update(type=type, code=name, qitaid=qitaid, alias=alias,
|
||||
organization_id=o_id, status=status,
|
||||
identificationcode=identificationcode, function=function,
|
||||
articleurl=articleurl)
|
||||
identificationcode=identificationcode, function=function,
|
||||
articleurl=articleurl)
|
||||
qita.image = image
|
||||
qita.save()
|
||||
messages.success(request, '修改成功')
|
||||
|
@ -1469,8 +1516,8 @@ def newmedia_management_update_qita(request, pk):
|
|||
else:
|
||||
Qita.objects.filter(id=pk).update(type=type, code=name, qitaid=qitaid, alias=alias,
|
||||
organization_id=o_id, status=status,
|
||||
identificationcode=identificationcode, function=function,
|
||||
articleurl=articleurl)
|
||||
identificationcode=identificationcode, function=function,
|
||||
articleurl=articleurl)
|
||||
messages.success(request, '修改成功')
|
||||
return HttpResponseRedirect('/management/newmedia/management/edit/qita/')
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue