#功能修改

This commit is contained in:
xieshen 2020-10-10 15:54:36 +08:00
parent de6670e3ab
commit 8f50a5cd32
13 changed files with 504 additions and 348 deletions

View File

@ -14,7 +14,7 @@
<li class=""> <li class="">
<a href="#" data-toggle="dropdown" class="toggle"> <a href="#" data-toggle="dropdown" class="toggle">
<i class="fa fa-envelope"></i> <i class="fa fa-envelope"></i>
<span class="badge badge-primary">7</span> <span class="badge badge-primary">0</span>
</a> </a>
<ul class="dropdown-menu messages animated fadeIn"> <ul class="dropdown-menu messages animated fadeIn">
@ -181,7 +181,7 @@
<li class=""> <li class="">
<a href="#" data-toggle="dropdown" class="toggle"> <a href="#" data-toggle="dropdown" class="toggle">
<i class="fa fa-bell"></i> <i class="fa fa-bell"></i>
<span class="badge badge-orange">3</span> <span class="badge badge-orange">0</span>
</a> </a>
<ul class="dropdown-menu notifications animated fadeIn"> <ul class="dropdown-menu notifications animated fadeIn">
<li class="total"> <li class="total">

View File

@ -1,3 +1,5 @@
{% load startswith %}
{% with request.resolver_match.url_name as url_name %}
<div class="page-sidebar-wrapper" id="main-menu-wrapper" style="min-height: 1000px"> <div class="page-sidebar-wrapper" id="main-menu-wrapper" style="min-height: 1000px">
<!-- USER INFO - START --> <!-- USER INFO - START -->
<div class="profile-info row"> <div class="profile-info row">
@ -29,14 +31,14 @@
<ul class='wraplist'> <ul class='wraplist'>
<li class=""> <li {% if url_name == 'monitor-new-media-public-opinion-weixin' %} class="open" {% endif %} >
<a href="{% url 'monitor-new-media-public-opinion-weixin' %}"> <a href="{% url 'monitor-new-media-public-opinion-weixin' %}">
<i class="fa fa-th"></i> <i class="fa fa-th"></i>
<span class="title">新媒体舆情</span> <span class="title">新媒体舆情</span>
</a> </a>
</li> </li>
{# <li class="open">#} {# <li class="open">#}
<li class=""> <li {% if url_name == 'monitor-timeliness-monitoring' %} class="open" {% endif %}>
<a href="{% url 'monitor-timeliness-monitoring' %}"> <a href="{% url 'monitor-timeliness-monitoring' %}">
<i class="fa fa-map-marker"></i> <i class="fa fa-map-marker"></i>
<span class="title">时效性监测</span> <span class="title">时效性监测</span>
@ -51,31 +53,31 @@
{# </li>#} {# </li>#}
{# </ul>#} {# </ul>#}
</li> </li>
<li class=""> <li {% if url_name == 'monitor-error-monitoring' %} class="open" {% endif %}>
<a href="{% url 'monitor-error-monitoring' %}"> <a href="{% url 'monitor-error-monitoring' %}">
<i class="fa fa-bar-chart"></i> <i class="fa fa-bar-chart"></i>
<span class="title">错别字监测</span> <span class="title">错别字监测</span>
</a> </a>
</li> </li>
<li class=""> <li {% if url_name == 'monitor-sensitive-word-monitoring' %} class="open" {% endif %}>
<a href="{% url 'monitor-sensitive-word-monitoring' %}"> <a href="{% url 'monitor-sensitive-word-monitoring' %}">
<i class="fa fa-folder-open"></i> <i class="fa fa-folder-open"></i>
<span class="title">敏感词监测</span> <span class="title">敏感词监测</span>
</a> </a>
</li> </li>
<li class=""> <li {% if url_name == 'monitor-comment-on-interactive-monitoring' %} class="open" {% endif %}>
<a href="{% url 'monitor-comment-on-interactive-monitoring' %}"> <a href="{% url 'monitor-comment-on-interactive-monitoring' %}">
<i class="fa fa-th"></i> <i class="fa fa-th"></i>
<span class="title">评论互动监测</span> <span class="title">评论互动监测</span>
</a> </a>
</li> </li>
<li class=""> <li {% if url_name == 'monitor-monitoring-report' %} class="open" {% endif %}>
<a href="{% url 'monitor-monitoring-report' %}"> <a href="{% url 'monitor-monitoring-report' %}">
<i class="fa fa-suitcase"></i> <i class="fa fa-suitcase"></i>
<span class="title">监测报告</span> <span class="title">监测报告</span>
</a> </a>
</li> </li>
<li class=""> <li {% if url_name|startswith:'group' %}class="open" {% endif %}>
<a href="javascript:;"> <a href="javascript:;">
<i class="fa fa-sliders"></i> <i class="fa fa-sliders"></i>
<span class="title">矩阵管理</span> <span class="title">矩阵管理</span>
@ -83,47 +85,47 @@
</a> </a>
<ul class="sub-menu"> <ul class="sub-menu">
<li> <li>
<a class="" href="{% url 'group-management-create' %}">新建矩阵</a> <a {% if url_name == 'group-management-create' %} class="active" {% endif %} href="{% url 'group-management-create' %}">新建矩阵</a>
</li> </li>
<li> <li>
<a class="" href="{% url 'group-management-management-init' %}">编辑矩阵</a> <a {% if url_name == 'group-management-management-init' %} class="active" {% endif %} href="{% url 'group-management-management-init' %}">编辑矩阵</a>
</li>
<li>
<a class="" href="">搜索添加单位</a>
</li> </li>
{# <li>#}
{# <a class="" href="">搜索添加单位</a>#}
{# </li>#}
</ul> </ul>
</li> </li>
<li class=""> <li {% if url_name|startswith:'newmedia' %}class="open" {% endif %}>
<a href="javascript:;"> <a href="javascript:;">
<i class="fa fa-gift"></i> <i class="fa fa-gift"></i>
<span class="title">新媒体管理</span> <span class="title">新媒体管理</span>
<span class="arrow "></span><span class="label label-orange">NEW</span> {# <span class="arrow "></span><span class="label label-orange">NEW</span>#}
</a> </a>
<ul class="sub-menu"> <ul class="sub-menu">
<li> <li>
<a class="" href="{% url 'newmedia-management-create-menu' %}">新建新媒体</a> <a {% if url_name == 'newmedia-management-create-menu' %} class="active" {% endif %} href="{% url 'newmedia-management-create-menu' %}">新建新媒体</a>
</li> </li>
<li> <li>
<a class="" href="{% url 'newmedia-management-edit-menu' %}">编辑新媒体</a> <a {% if url_name == 'newmedia-management-edit-menu' %} class="active" {% endif %} href="{% url 'newmedia-management-edit-menu' %}">编辑新媒体</a>
</li> </li>
</ul> </ul>
</li> </li>
<li class=""> <li {% if url_name|startswith:'organization' %}class="open" {% endif %}>
<a href="javascript:;"> <a href="javascript:;">
<i class="fa fa-envelope"></i> <i class="fa fa-envelope"></i>
<span class="title">主体单位管理</span> <span class="title">主体单位管理</span>
<span class="arrow "></span><span class="label label-orange">4</span> {# <span class="arrow "></span><span class="label label-orange">0</span>#}
</a> </a>
<ul class="sub-menu"> <ul class="sub-menu">
<li> <li>
<a class="" href="{% url 'organization-management-create' %}">新建单位</a> <a {% if url_name == 'organization-management-create' %} class="active" {% endif %} href="{% url 'organization-management-create' %}">新建单位</a>
</li> </li>
<li> <li>
<a class="" href="{% url 'organization-management-management' %}">编辑单位</a> <a {% if url_name == 'organization-management-management' %} class="active" {% endif %} href="{% url 'organization-management-management' %}">编辑单位</a>
</li> </li>
</ul> </ul>
</li> </li>
<li class=""> <li {% if url_name|startswith:'news' %}class="open" {% endif %}>
<a href="javascript:;"> <a href="javascript:;">
<i class="fa fa-sliders"></i> <i class="fa fa-sliders"></i>
<span class="title">新闻管理</span> <span class="title">新闻管理</span>
@ -131,20 +133,20 @@
</a> </a>
<ul class="sub-menu"> <ul class="sub-menu">
<li> <li>
<a class="" href="{% url 'news-management-create' %}">发布新闻</a> <a {% if url_name == 'news-management-create' %} class="active" {% endif %} href="{% url 'news-management-create' %}">发布新闻</a>
</li> </li>
<li> <li>
<a class="" href="{% url 'new-management' %}">新闻管理</a> <a {% if url_name == 'news-management' %} class="active" {% endif %} href="{% url 'news-management' %}">新闻管理</a>
</li> </li>
</ul> </ul>
</li> </li>
<li class=""> <li {% if url_name == 'user-management-management' %} class="open" {% endif %}>
<a href="{% url 'user-management-management' %}"> <a href="{% url 'user-management-management' %}">
<i class="fa fa-columns"></i> <i class="fa fa-columns"></i>
<span class="title">用户管理</span> <span class="title">用户管理</span>
</a> </a>
</li> </li>
<li class=""> <li {% if url_name == 'user-management-update' %} class="open" {% endif %}>
<a href="{% url 'user-management-update' user.id %}"> <a href="{% url 'user-management-update' user.id %}">
<i class="fa fa-dashboard"></i> <i class="fa fa-dashboard"></i>
<span class="title">系统设置</span> <span class="title">系统设置</span>
@ -200,3 +202,4 @@
</ul> </ul>
</div> </div>
{% endwith %}

View File

@ -0,0 +1,10 @@
from django import template
register = template.Library()
@register.filter(name='startswith')
def startswith(text, starts):
if isinstance(text, str):
return text.startswith(starts)
return False

View File

@ -172,7 +172,7 @@ def register(request):
def get_province(request): def get_province(request):
# 省 # 省
province = Area_code_2020.objects.filter(level=1) province = Area_code_2020.objects.filter(level=1,name='甘肃省')
res = [] res = []
for i in province: for i in province:
res.append([i.code, i.name, i.level, i.pcode]) res.append([i.code, i.name, i.level, i.pcode])

View File

@ -41,7 +41,8 @@
<div class="row"> <div class="row">
<div class="col-md-8 col-sm-9 col-xs-10"> <div class="col-md-8 col-sm-9 col-xs-10">
<form method="post" <form method="post"
action="{% url 'group-management-update' group.id %}" enctype="multipart/form-data">{% csrf_token %} action="{% url 'group-management-update' group.id %}"
enctype="multipart/form-data">{% csrf_token %}
<div class="form-group"> <div class="form-group">
<label class="form-label" for="name">矩阵名称</label> <label class="form-label" for="name">矩阵名称</label>
<div class="controls"> <div class="controls">
@ -92,26 +93,27 @@
<label class="form-label" for="administrativedivision">行政区划</label> <label class="form-label" for="administrativedivision">行政区划</label>
<div class="controls"> <div class="controls">
<select id="province" name="province"> <select id="province" name="province">
<option value="{{ group.province }}">{{ group.province }}</option> <option value="{{ group.province }}">{{ p }}</option>
</select> </select>
<select id="city" name="city" style="margin-left: 20px"> <select id="city" name="city" style="margin-left: 20px">
<option value="{{ group.cities }}">{{ group.cities }}</option> <option value="{{ group.cities }}">{{ c }}</option>
</select> </select>
<select id="district" name="district" style="margin-left: 20px"> <select id="district" name="district" style="margin-left: 20px">
<option value="{{ group.district }}">{{ group.district }}</option> <option value="{{ group.district }}">{{ d }}</option>
</select> </select>
<select id="town" name="town" style="margin-left: 20px"> <select id="town" name="town" style="margin-left: 20px">
<option value="{{ group.town }}">{{ group.town }}</option> <option value="{{ group.town }}">{{ t }}</option>
</select> </select>
<select id="village" name="village" style="margin-left: 20px"> <select id="village" name="village" style="margin-left: 20px">
<option value="{{ group.village }}">{{ group.village }}</option> <option value="{{ group.village }}">{{ v }}</option>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="form-label" for="stauts">管理员</label> <label class="form-label" for="stauts">管理员</label>
<div class="controls" style="margin-left: 5%"> <div class="controls" style="margin-left: 5%">
<a href="{% url 'group-admin-create' group.id %}"><span class="glyphicon glyphicon-plus" aria-hidden="true">添加管理员</span></a> <a href="{% url 'group-admin-create' group.id %}"><span
class="glyphicon glyphicon-plus" aria-hidden="true">添加管理员</span></a>
<table class="table table-hover" style="margin-top: 20px"> <table class="table table-hover" style="margin-top: 20px">
<thead> <thead>
<tr> <tr>
@ -147,7 +149,8 @@
<div class="form-group"> <div class="form-group">
<label class="form-label" for="stauts">成员</label> <label class="form-label" for="stauts">成员</label>
<div class="controls" style="margin-left: 5%"> <div class="controls" style="margin-left: 5%">
<a href="{% url 'group-user-create' group.id %}"><span class="glyphicon glyphicon-plus" aria-hidden="true">添加成员</span></a> <a href="{% url 'group-user-create' group.id %}"><span
class="glyphicon glyphicon-plus" aria-hidden="true">添加成员</span></a>
<table class="table table-hover" style="margin-top: 20px"> <table class="table table-hover" style="margin-top: 20px">
<thead> <thead>
<tr> <tr>
@ -194,3 +197,78 @@
</div> </div>
</body> </body>
{% endblock %} {% endblock %}
{% block add_js %}
<script>
$(function () {
$.get('/get/province/', function (data) {
for (var i = 0, len = data.province.length; i < len; i++) {
$new = $("<option value=" + data.province[i][0] + ">" + data.province[i][1] + "</option>");
$("#province").append($new);
}
})
//当省份改变后
$("#province").change(function () {
$("#city").empty().append('<option value="">请选择市</option>');
$("#district").empty().append('<option value="">请选择区/县</option>');
$("#town").empty().append('<option value="">请选择乡/镇</option>');
$("#village").empty().append('<option value="">请选择村/街道</option>');
$.ajax({
url: '/get/city/',
type: 'get',
data: {"code": $(this).val()}
}).done(function (data) {
for (var i = 0, len = data.city.length; i < len; i++) {
$new = $("<option value=" + data.city[i][0] + ">" + data.city[i][1] + "</option>");
$("#city").append($new);
}
})
})
//当城市改变后
$("#city").change(function () {
$("#district").empty().append('<option value="">请选择区/县</option>');
$("#town").empty().append('<option value="">请选择乡/镇</option>');
$("#village").empty().append('<option value="">请选择村/街道</option>');
$.ajax({
url: '/get/district/',
type: 'get',
data: {"code": $(this).val()}
}).done(function (data) {
for (var i = 0, len = data.district.length; i < len; i++) {
$new = $("<option value=" + data.district[i][0] + ">" + data.district[i][1] + "</option>");
$("#district").append($new);
}
})
})
//当县改变后
$("#district").change(function () {
$("#town").empty().append('<option value="">请选择乡/镇</option>');
$("#village").empty().append('<option value="">请选择村/街道</option>');
$.ajax({
url: '/get/town/',
type: 'get',
data: {"code": $(this).val()}
}).done(function (data) {
for (var i = 0, len = data.town.length; i < len; i++) {
$new = $("<option value=" + data.town[i][0] + ">" + data.town[i][1] + "</option>");
$("#town").append($new);
}
})
})
//当乡改变后
$("#district").change(function () {
$("#village").empty().append('<option value="">请选择村/街道</option>');
$.ajax({
url: '/get/village/',
type: 'get',
data: {"code": $(this).val()}
}).done(function (data) {
for (var i = 0, len = data.village.length; i < len; i++) {
$new = $("<option value=" + data.village[i][0] + ">" + data.village[i][1] + "</option>");
$("#village").append($new);
}
})
})
})
</script>
{% endblock %}

View File

@ -71,7 +71,7 @@
<td style="vertical-align: middle;text-align: center">{{ r.name }}</td> <td style="vertical-align: middle;text-align: center">{{ r.name }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.type }}</td> <td style="vertical-align: middle;text-align: center">{{ r.type }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.admin_count }}</td> <td style="vertical-align: middle;text-align: center">{{ r.admin_count }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.admin_count }}</td> <td style="vertical-align: middle;text-align: center">{{ r.user_count }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.status }}</td> <td style="vertical-align: middle;text-align: center">{{ r.status }}</td>
<td style="vertical-align: middle;text-align: center"> <td style="vertical-align: middle;text-align: center">
<a href="{% url 'group-management-update' r.id %}" <a href="{% url 'group-management-update' r.id %}"

View File

@ -112,7 +112,7 @@
<div class="controls"> <div class="controls">
<select class="form-control" name="classify"> <select class="form-control" name="classify">
{% for g in g_c_c_res %} {% for g in g_c_c_res %}
<option value="{{ g }}">{{ g }}</option> <option value="{{ g.0 }}">{{ g.1 }}</option>
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
@ -135,8 +135,11 @@
<script> <script>
$(function () { $(function () {
$.get('/get/province/', function (data) { $.get('/get/province/', function (data) {
{#s = "<option value='620000000000' selected>甘肃省</option>"#}
{#$("#province").append(s);#}
for (var i = 0, len = data.province.length; i < len; i++) { for (var i = 0, len = data.province.length; i < len; i++) {
$new = $("<option value=" + data.province[i][0] + ">" + data.province[i][1] + "</option>"); $new = $("<option value=" + data.province[i][0] + ">" + data.province[i][1] + "</option>");
$("#province").append($new); $("#province").append($new);
} }
}) })

View File

@ -71,7 +71,7 @@
<td style="vertical-align: middle;text-align: center">{{ r.name }}</td> <td style="vertical-align: middle;text-align: center">{{ r.name }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.type }}</td> <td style="vertical-align: middle;text-align: center">{{ r.type }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.admin_count }}</td> <td style="vertical-align: middle;text-align: center">{{ r.admin_count }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.admin_count }}</td> <td style="vertical-align: middle;text-align: center">{{ r.user_count }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.status }}</td> <td style="vertical-align: middle;text-align: center">{{ r.status }}</td>
<td style="vertical-align: middle;text-align: center"> <td style="vertical-align: middle;text-align: center">
<a href="{% url 'group-management-update' r.id %}" <a href="{% url 'group-management-update' r.id %}"

View File

@ -41,7 +41,8 @@
<div class="row"> <div class="row">
<div class="col-md-8 col-sm-9 col-xs-10"> <div class="col-md-8 col-sm-9 col-xs-10">
<form method="post" <form method="post"
action="{% url 'group-management-update' group.id %}" enctype="multipart/form-data">{% csrf_token %} action="{% url 'group-management-update' group.id %}"
enctype="multipart/form-data">{% csrf_token %}
<div class="form-group"> <div class="form-group">
<label class="form-label" for="name">矩阵名称</label> <label class="form-label" for="name">矩阵名称</label>
<div class="controls"> <div class="controls">
@ -92,19 +93,19 @@
<label class="form-label" for="administrativedivision">行政区划</label> <label class="form-label" for="administrativedivision">行政区划</label>
<div class="controls"> <div class="controls">
<select id="province" name="province"> <select id="province" name="province">
<option value="{{ group.province }}">{{ group.province }}</option> <option value="{{ group.province }}">{{ p }}</option>
</select> </select>
<select id="city" name="city" style="margin-left: 20px"> <select id="city" name="city" style="margin-left: 20px">
<option value="{{ group.cities }}">{{ group.cities }}</option> <option value="{{ group.cities }}">{{ c }}</option>
</select> </select>
<select id="district" name="district" style="margin-left: 20px"> <select id="district" name="district" style="margin-left: 20px">
<option value="{{ group.district }}">{{ group.district }}</option> <option value="{{ group.district }}">{{ d }}</option>
</select> </select>
<select id="town" name="town" style="margin-left: 20px"> <select id="town" name="town" style="margin-left: 20px">
<option value="{{ group.town }}">{{ group.town }}</option> <option value="{{ group.town }}">{{ t }}</option>
</select> </select>
<select id="village" name="village" style="margin-left: 20px"> <select id="village" name="village" style="margin-left: 20px">
<option value="{{ group.village }}">{{ group.village }}</option> <option value="{{ group.village }}">{{ v }}</option>
</select> </select>
</div> </div>
</div> </div>
@ -112,7 +113,13 @@
<label class="form-label" for="classify">矩阵分类</label> <label class="form-label" for="classify">矩阵分类</label>
<div class="controls"> <div class="controls">
<select class="form-control" name="classify"> <select class="form-control" name="classify">
<option value="{{ group.classify }}">{{ group.classify }}</option> {% if group.classify == '0' %}
<option value="{{ group.classify }}">区域</option>
{% elif group.classify == '1' %}
<option value="{{ group.classify }}">媒体种类</option>
{% elif group.classify == '2' %}
<option value="{{ group.classify }}">行业</option>
{% endif %}
{% for g in g_c_c_res %} {% for g in g_c_c_res %}
<option value="{{ g }}">{{ g }}</option> <option value="{{ g }}">{{ g }}</option>
{% endfor %} {% endfor %}
@ -122,7 +129,8 @@
<div class="form-group"> <div class="form-group">
<label class="form-label" for="stauts">管理员</label> <label class="form-label" for="stauts">管理员</label>
<div class="controls" style="margin-left: 5%"> <div class="controls" style="margin-left: 5%">
<a href="{% url 'group-admin-create' group.id %}"><span class="glyphicon glyphicon-plus" aria-hidden="true">添加管理员</span></a> <a href="{% url 'group-admin-create' group.id %}"><span
class="glyphicon glyphicon-plus" aria-hidden="true">添加管理员</span></a>
<table class="table table-hover" style="margin-top: 20px"> <table class="table table-hover" style="margin-top: 20px">
<thead> <thead>
<tr> <tr>
@ -158,7 +166,8 @@
<div class="form-group"> <div class="form-group">
<label class="form-label" for="stauts">成员</label> <label class="form-label" for="stauts">成员</label>
<div class="controls" style="margin-left: 5%"> <div class="controls" style="margin-left: 5%">
<a href="{% url 'group-user-create' group.id %}"><span class="glyphicon glyphicon-plus" aria-hidden="true">添加成员</span></a> <a href="{% url 'group-user-create' group.id %}"><span
class="glyphicon glyphicon-plus" aria-hidden="true">添加成员</span></a>
<table class="table table-hover" style="margin-top: 20px"> <table class="table table-hover" style="margin-top: 20px">
<thead> <thead>
<tr> <tr>

View File

@ -70,7 +70,7 @@
<td style="vertical-align: middle;text-align: center">{{ r.name }}</td> <td style="vertical-align: middle;text-align: center">{{ r.name }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.type }}</td> <td style="vertical-align: middle;text-align: center">{{ r.type }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.admin_count }}</td> <td style="vertical-align: middle;text-align: center">{{ r.admin_count }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.admin_count }}</td> <td style="vertical-align: middle;text-align: center">{{ r.user_count }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.status }}</td> <td style="vertical-align: middle;text-align: center">{{ r.status }}</td>
</tr> </tr>
{% endfor %} {% endfor %}

View File

@ -53,7 +53,7 @@ urlpatterns = [
path('newmedia/detail/<str:pk>/weixin/',views.newmedia_detail_weixin,name='newmedia-detail-weixin'), path('newmedia/detail/<str:pk>/weixin/',views.newmedia_detail_weixin,name='newmedia-detail-weixin'),
#新闻管理 #新闻管理
path('news/management/',views.new_management,name='new-management'), path('news/management/',views.new_management,name='news-management'),
path('news/management/create/', views.news_management_create, name='news-management-create'), path('news/management/create/', views.news_management_create, name='news-management-create'),
path('news/management/detail/<str:pk>/', views.news_management_detail, name='news-management-detail'), path('news/management/detail/<str:pk>/', views.news_management_detail, name='news-management-detail'),
path('news/management/delete/<str:pk>/', views.news_management_delete, name='news-management-delete'), path('news/management/delete/<str:pk>/', views.news_management_delete, name='news-management-delete'),

View File

@ -83,7 +83,8 @@ def user_update(request, pk):
passwordold = request.POST.get('passwordold') passwordold = request.POST.get('passwordold')
passwordnew = request.POST.get('passwordnew') passwordnew = request.POST.get('passwordnew')
confirm_password = request.POST.get('confirm_password') confirm_password = request.POST.get('confirm_password')
if passwordold is not None and passwordnew is not None and confirm_password is not None: print(len(passwordold), len(passwordnew), confirm_password)
if len(passwordold) != 0 and len(passwordnew) != 0 and len(confirm_password) != 0:
if passwordnew == confirm_password: if passwordnew == confirm_password:
user.email = email user.email = email
user.username = username user.username = username
@ -109,7 +110,7 @@ def user_update(request, pk):
user.save() user.save()
userprofile.save() userprofile.save()
messages.success(request, "修改成功") messages.success(request, "修改成功")
return HttpResponseRedirect("/") return HttpResponseRedirect("/index")
return render(request, 'management/user-management-update.html', return render(request, 'management/user-management-update.html',
{'usee': user, 'userprofile': userprofile, 'organization': organization}) {'usee': user, 'userprofile': userprofile, 'organization': organization})
@ -119,7 +120,7 @@ def user_update(request, pk):
def group_management_init(request): def group_management_init(request):
user = request.user user = request.user
# 创建的矩阵 # 创建的矩阵
group_initer = Group.objects.filter(user_id=user.id) group_initer = Group.objects.filter(user_id=user.id).order_by('-created')
print(group_initer) print(group_initer)
paginator = Paginator(group_initer, 6) paginator = Paginator(group_initer, 6)
page = int(request.GET.get('page', 1)) page = int(request.GET.get('page', 1))
@ -148,7 +149,7 @@ def group_management_admin(request):
# 管理的矩阵 # 管理的矩阵
user = request.user user = request.user
group_admin_list = [] group_admin_list = []
for g_a in Group_admin.objects.filter(user_id=user.id): for g_a in Group_admin.objects.filter(user_id=user.id).order_by('-created'):
group_admin = Group.objects.get(id=g_a.group_id) group_admin = Group.objects.get(id=g_a.group_id)
group_admin_list.append(group_admin) group_admin_list.append(group_admin)
paginator = Paginator(group_admin_list, 6) paginator = Paginator(group_admin_list, 6)
@ -178,7 +179,7 @@ def group_management_user(request):
# 加入的矩阵 # 加入的矩阵
user = request.user user = request.user
group_user_list = [] group_user_list = []
for g_u in Group_user.objects.filter(user_id=user.id): for g_u in Group_user.objects.filter(user_id=user.id).order_by('-created'):
group_user = Group.objects.get(id=g_u.group_id) group_user = Group.objects.get(id=g_u.group_id)
group_user_list.append(group_user) group_user_list.append(group_user)
paginator = Paginator(group_user_list, 6) paginator = Paginator(group_user_list, 6)
@ -206,6 +207,21 @@ def group_management_user(request):
@login_required @login_required
def group_update(request, pk): def group_update(request, pk):
group = Group.objects.get(id=pk) group = Group.objects.get(id=pk)
p = ''
c = ''
d = ''
t = ''
v = ''
if group.province:
p = Area_code_2020.objects.get(code=group.province).name
if group.cities:
c = Area_code_2020.objects.get(code=group.cities).name
if group.district:
d = Area_code_2020.objects.get(code=group.district).name
if group.town:
t = Area_code_2020.objects.get(code=group.town).name
if group.village:
v = Area_code_2020.objects.get(code=group.village).name
group_status_choices_list = [] group_status_choices_list = []
for g in range(2): for g in range(2):
group_status_choices_list.append(g) group_status_choices_list.append(g)
@ -249,27 +265,27 @@ def group_update(request, pk):
classify = request.POST.get('classify') classify = request.POST.get('classify')
print(str(province) + "66666666666666666666666666") print(str(province) + "66666666666666666666666666")
if province != '' and province.isdigit(): if province != '' and province.isdigit():
province_r = Area_code_2020.objects.get(code=province).name province_r = province
else: else:
province_r = province province_r = province
city = request.POST.get('city') city = request.POST.get('city')
if city != '' and city.isdigit(): if city != '' and city.isdigit():
city_r = Area_code_2020.objects.get(code=city).name city_r = city
else: else:
city_r = city city_r = city
district = request.POST.get('district') district = request.POST.get('district')
if district != '' and district.isdigit(): if district != '' and district.isdigit():
district_r = Area_code_2020.objects.get(code=district).name district_r = district
else: else:
district_r = district district_r = district
town = request.POST.get('town') town = request.POST.get('town')
if town != '' and town.isdigit(): if town != '' and town.isdigit():
town_r = Area_code_2020.objects.get(code=town).name town_r = town
else: else:
town_r = town town_r = town
village = request.POST.get('village') village = request.POST.get('village')
if village != '' and village.isdigit(): if village != '' and village.isdigit():
village_r = Area_code_2020.objects.get(code=village).name village_r = village
else: else:
village_r = village village_r = village
if image is not None: if image is not None:
@ -289,7 +305,8 @@ def group_update(request, pk):
return HttpResponseRedirect('/management/group/management/init/') return HttpResponseRedirect('/management/group/management/init/')
return render(request, 'management/group-management-update.html', return render(request, 'management/group-management-update.html',
{'group': group, 'group_status_choices_list': group_status_choices_list, 'group_type': group_type, {'group': group, 'group_status_choices_list': group_status_choices_list, 'group_type': group_type,
'g_a_list': g_a_list, 'g_u_list': g_u_list, 'g_c_c_res': g_c_c_res}) 'g_a_list': g_a_list, 'g_u_list': g_u_list, 'g_c_c_res': g_c_c_res, 'p': p, 'c': c, 'd': d, 't': t,
'v': v})
@login_required @login_required
@ -302,38 +319,42 @@ def group_create(request):
GROUP_CLASSIFY_CHOICES = Group.GROUP_CLASSIFY_CHOICES GROUP_CLASSIFY_CHOICES = Group.GROUP_CLASSIFY_CHOICES
g_c_c_res = [] g_c_c_res = []
for g_c_c in GROUP_CLASSIFY_CHOICES: 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]])
if request.method == 'POST': if request.method == 'POST':
name = request.POST.get('name') name = request.POST.get('name')
presentation = request.POST.get('presentation') presentation = request.POST.get('presentation')
image = None
if not request.FILES.get('image'):
image = 'group.jpg'
else:
image = request.FILES.get('image') image = request.FILES.get('image')
type = request.POST.get('type') type = request.POST.get('type')
status = request.POST.get('status') status = request.POST.get('status')
province = request.POST.get('province') province = request.POST.get('province')
classify = request.POST.get('classify') classify = request.POST.get('classify')
if province != '': if province != '':
province_r = Area_code_2020.objects.get(code=province).name province_r = province
else: else:
messages.error(request, '请选择行政区划') messages.error(request, '请选择行政区划')
return HttpResponseRedirect('/management/organization/create/') return HttpResponseRedirect('/management/organization/create/')
city = request.POST.get('city') city = request.POST.get('city')
if city != '': if city != '':
city_r = Area_code_2020.objects.get(code=city).name city_r = city
else: else:
city_r = city city_r = city
district = request.POST.get('district') district = request.POST.get('district')
if district != '': if district != '':
district_r = Area_code_2020.objects.get(code=district).name district_r = district
else: else:
district_r = district district_r = district
town = request.POST.get('town') town = request.POST.get('town')
if town != '': if town != '':
town_r = Area_code_2020.objects.get(code=town).name town_r = town
else: else:
town_r = town town_r = town
village = request.POST.get('village') village = request.POST.get('village')
if village != '': if village != '':
village_r = Area_code_2020.objects.get(code=village).name village_r = village
else: else:
village_r = village village_r = village
print(name, presentation, image, type, status, province, city, district, town, village) print(name, presentation, image, type, status, province, city, district, town, village)
@ -342,8 +363,24 @@ def group_create(request):
province=province_r, cities=city_r, district=district_r, town=town_r, village=village_r, province=province_r, cities=city_r, district=district_r, town=town_r, village=village_r,
user_id=user.id, classify=classify) user_id=user.id, classify=classify)
group.save() group.save()
p = ''
c = ''
d = ''
t = ''
v = ''
if group.province:
p = Area_code_2020.objects.get(code=group.province).name
if group.cities:
c = Area_code_2020.objects.get(code=group.cities).name
if group.district:
d = Area_code_2020.objects.get(code=group.district).name
if group.town:
t = Area_code_2020.objects.get(code=group.town).name
if group.village:
v = Area_code_2020.objects.get(code=group.village).name
messages.success(request, '添加成功') messages.success(request, '添加成功')
return render(request, 'management/add-group-admin-and-user.html', {'group': group}) return render(request, 'management/add-group-admin-and-user.html',
{'group': group, 'p': p, 'c': c, 'd': d, 't': t, 'v': v})
else: else:
messages.error(request, '矩阵名不能为空') messages.error(request, '矩阵名不能为空')
# return HttpResponseRedirect('/management/group/management/') # return HttpResponseRedirect('/management/group/management/')
@ -422,6 +459,7 @@ def organization_management(request):
district = o.district district = o.district
print(level, province, cities, district) print(level, province, cities, district)
organization = None organization = None
res = []
if level == 1: if level == 1:
organization = Organization.objects.filter(province=province).order_by('-created') organization = Organization.objects.filter(province=province).order_by('-created')
elif level == 2: elif level == 2:
@ -438,14 +476,15 @@ def organization_management(request):
organization = paginator.page(1) organization = paginator.page(1)
except EmptyPage: except EmptyPage:
organization = paginator.page(paginator.num_pages) organization = paginator.page(paginator.num_pages)
res = []
for i in organization: for i in organization:
o = dict() o = dict()
o['id'] = str(i.id) o['id'] = str(i.id)
o['name'] = i.name o['name'] = i.name
o['image'] = i.image.url o['image'] = i.image.url
o['organizationtype'] = i.organizationtype.organizationtype o['organizationtype'] = i.organizationtype.organizationtype
if len(i.province) > 0 and len(i.cities) > 0 and len(i.district) > 0 and len(i.town) > 0 and len(i.village) > 0: if len(i.province) > 0 and len(i.cities) > 0 and len(i.district) > 0 and len(i.town) > 0 and len(
i.village) > 0:
o['administrativedivision'] = str(Area_code_2020.objects.get(code=i.province).name) + '-' + str( o['administrativedivision'] = str(Area_code_2020.objects.get(code=i.province).name) + '-' + str(
Area_code_2020.objects.get(code=i.cities).name) + '-' + str( Area_code_2020.objects.get(code=i.cities).name) + '-' + str(
Area_code_2020.objects.get(code=i.district).name) + '-' + str( Area_code_2020.objects.get(code=i.district).name) + '-' + str(
@ -467,7 +506,8 @@ def organization_management(request):
o['administrativedivision'] = str(Area_code_2020.objects.get(code=i.province).name) o['administrativedivision'] = str(Area_code_2020.objects.get(code=i.province).name)
o['usercount'] = Userprofile.objects.filter(organization_id=i.id).count() o['usercount'] = Userprofile.objects.filter(organization_id=i.id).count()
o['mediacount'] = Weixin.objects.filter(organization_id=i.id).count() + Weibo.objects.filter( o['mediacount'] = Weixin.objects.filter(organization_id=i.id).count() + Weibo.objects.filter(
organization_id=i.id).count() + Toutiao.objects.filter(organization_id=i.id).count() + Qita.objects.filter( organization_id=i.id).count() + Toutiao.objects.filter(
organization_id=i.id).count() + Qita.objects.filter(
organization_id=i.id).count() organization_id=i.id).count()
res.append(o) res.append(o)
@ -787,6 +827,7 @@ def newmedia_management_edit_weixin(request):
cities = o.cities cities = o.cities
district = o.district district = o.district
weixin = None weixin = None
res = []
if level == 1: if level == 1:
weixin = Weixin.objects.filter(organization__province=province).order_by('-created') weixin = Weixin.objects.filter(organization__province=province).order_by('-created')
elif level == 2: elif level == 2:
@ -796,6 +837,7 @@ def newmedia_management_edit_weixin(request):
weixin = Weixin.objects.filter(organization__province=province, organization__cities=cities, weixin = Weixin.objects.filter(organization__province=province, organization__cities=cities,
organization__district=district).order_by( organization__district=district).order_by(
'-created') '-created')
if weixin is not None:
paginator = Paginator(weixin, 6) paginator = Paginator(weixin, 6)
page = int(request.GET.get('page', 1)) page = int(request.GET.get('page', 1))
try: try:
@ -804,7 +846,7 @@ def newmedia_management_edit_weixin(request):
weixin = paginator.page(1) weixin = paginator.page(1)
except EmptyPage: except EmptyPage:
weixin = paginator.page(paginator.num_pages) weixin = paginator.page(paginator.num_pages)
res = []
for w in weixin: for w in weixin:
o = dict() o = dict()
o['id'] = str(w.id) o['id'] = str(w.id)
@ -828,7 +870,8 @@ def newmedia_management_edit_weixin(request):
Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str(
Area_code_2020.objects.get(code=w.organization.district).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.district).name) + '-' + str(
Area_code_2020.objects.get(code=w.organization.town).name) Area_code_2020.objects.get(code=w.organization.town).name)
elif len(w.organization.province) > 0 and len(w.organization.cities) > 0 and len(w.organization.district) > 0: elif len(w.organization.province) > 0 and len(w.organization.cities) > 0 and len(
w.organization.district) > 0:
o['administrativedivision'] = str( o['administrativedivision'] = str(
Area_code_2020.objects.get(code=w.organization.province).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.province).name) + '-' + str(
Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str(
@ -853,6 +896,7 @@ def newmedia_management_edit_weibo(request):
cities = o.cities cities = o.cities
district = o.district district = o.district
weibo = None weibo = None
res = []
if level == 1: if level == 1:
weibo = Weibo.objects.filter(organization__province=province).order_by('-created') weibo = Weibo.objects.filter(organization__province=province).order_by('-created')
elif level == 2: elif level == 2:
@ -860,6 +904,7 @@ def newmedia_management_edit_weibo(request):
elif level == 3: elif level == 3:
weibo = Weibo.objects.filter(organization__province=province, organization__cities=cities, weibo = Weibo.objects.filter(organization__province=province, organization__cities=cities,
organization__district=district).order_by('-created') organization__district=district).order_by('-created')
if weibo is not None:
paginator = Paginator(weibo, 6) paginator = Paginator(weibo, 6)
page = int(request.GET.get('page', 1)) page = int(request.GET.get('page', 1))
try: try:
@ -868,7 +913,7 @@ def newmedia_management_edit_weibo(request):
weibo = paginator.page(1) weibo = paginator.page(1)
except EmptyPage: except EmptyPage:
weibo = paginator.page(paginator.num_pages) weibo = paginator.page(paginator.num_pages)
res = []
for w in weibo: for w in weibo:
o = dict() o = dict()
o['id'] = str(w.id) o['id'] = str(w.id)
@ -892,7 +937,8 @@ def newmedia_management_edit_weibo(request):
Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str(
Area_code_2020.objects.get(code=w.organization.district).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.district).name) + '-' + str(
Area_code_2020.objects.get(code=w.organization.town).name) Area_code_2020.objects.get(code=w.organization.town).name)
elif len(w.organization.province) > 0 and len(w.organization.cities) > 0 and len(w.organization.district) > 0: elif len(w.organization.province) > 0 and len(w.organization.cities) > 0 and len(
w.organization.district) > 0:
o['administrativedivision'] = str( o['administrativedivision'] = str(
Area_code_2020.objects.get(code=w.organization.province).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.province).name) + '-' + str(
Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str(
@ -917,6 +963,7 @@ def newmedia_management_edit_toutiao(request):
cities = o.cities cities = o.cities
district = o.district district = o.district
toutiao = None toutiao = None
res = []
if level == 1: if level == 1:
toutiao = Toutiao.objects.filter(organization__province=province).order_by('-created') toutiao = Toutiao.objects.filter(organization__province=province).order_by('-created')
elif level == 2: elif level == 2:
@ -926,6 +973,7 @@ def newmedia_management_edit_toutiao(request):
toutiao = Toutiao.objects.filter(organization__province=province, organization__cities=cities, toutiao = Toutiao.objects.filter(organization__province=province, organization__cities=cities,
organization__district=district).order_by( organization__district=district).order_by(
'-created') '-created')
if toutiao is not None:
paginator = Paginator(toutiao, 6) paginator = Paginator(toutiao, 6)
page = int(request.GET.get('page', 1)) page = int(request.GET.get('page', 1))
try: try:
@ -934,7 +982,6 @@ def newmedia_management_edit_toutiao(request):
toutiao = paginator.page(1) toutiao = paginator.page(1)
except EmptyPage: except EmptyPage:
toutiao = paginator.page(paginator.num_pages) toutiao = paginator.page(paginator.num_pages)
res = []
for w in toutiao: for w in toutiao:
o = dict() o = dict()
o['id'] = str(w.id) o['id'] = str(w.id)
@ -958,7 +1005,8 @@ def newmedia_management_edit_toutiao(request):
Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str(
Area_code_2020.objects.get(code=w.organization.district).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.district).name) + '-' + str(
Area_code_2020.objects.get(code=w.organization.town).name) Area_code_2020.objects.get(code=w.organization.town).name)
elif len(w.organization.province) > 0 and len(w.organization.cities) > 0 and len(w.organization.district) > 0: elif len(w.organization.province) > 0 and len(w.organization.cities) > 0 and len(
w.organization.district) > 0:
o['administrativedivision'] = str( o['administrativedivision'] = str(
Area_code_2020.objects.get(code=w.organization.province).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.province).name) + '-' + str(
Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str(
@ -983,6 +1031,7 @@ def newmedia_management_edit_douyin(request):
cities = o.cities cities = o.cities
district = o.district district = o.district
douyin = None douyin = None
res = []
if level == 1: if level == 1:
douyin = Douyin.objects.filter(organization__province=province).order_by('-created') douyin = Douyin.objects.filter(organization__province=province).order_by('-created')
elif level == 2: elif level == 2:
@ -992,6 +1041,7 @@ def newmedia_management_edit_douyin(request):
douyin = Douyin.objects.filter(organization__province=province, organization__cities=cities, douyin = Douyin.objects.filter(organization__province=province, organization__cities=cities,
organization__district=district).order_by( organization__district=district).order_by(
'-created') '-created')
if douyin is not None:
paginator = Paginator(douyin, 6) paginator = Paginator(douyin, 6)
page = int(request.GET.get('page', 1)) page = int(request.GET.get('page', 1))
try: try:
@ -1000,7 +1050,6 @@ def newmedia_management_edit_douyin(request):
douyin = paginator.page(1) douyin = paginator.page(1)
except EmptyPage: except EmptyPage:
douyin = paginator.page(paginator.num_pages) douyin = paginator.page(paginator.num_pages)
res = []
for w in douyin: for w in douyin:
o = dict() o = dict()
o['id'] = str(w.id) o['id'] = str(w.id)
@ -1024,7 +1073,8 @@ def newmedia_management_edit_douyin(request):
Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str(
Area_code_2020.objects.get(code=w.organization.district).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.district).name) + '-' + str(
Area_code_2020.objects.get(code=w.organization.town).name) Area_code_2020.objects.get(code=w.organization.town).name)
elif len(w.organization.province) > 0 and len(w.organization.cities) > 0 and len(w.organization.district) > 0: elif len(w.organization.province) > 0 and len(w.organization.cities) > 0 and len(
w.organization.district) > 0:
o['administrativedivision'] = str( o['administrativedivision'] = str(
Area_code_2020.objects.get(code=w.organization.province).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.province).name) + '-' + str(
Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str(
@ -1049,6 +1099,7 @@ def newmedia_management_edit_qita(request):
cities = o.cities cities = o.cities
district = o.district district = o.district
qita = None qita = None
res = []
if level == 1: if level == 1:
qita = Qita.objects.filter(organization__province=province).order_by('-created') qita = Qita.objects.filter(organization__province=province).order_by('-created')
elif level == 2: elif level == 2:
@ -1056,6 +1107,7 @@ def newmedia_management_edit_qita(request):
elif level == 3: elif level == 3:
qita = Qita.objects.filter(organization__province=province, organization__cities=cities, qita = Qita.objects.filter(organization__province=province, organization__cities=cities,
organization__district=district).order_by('-created') organization__district=district).order_by('-created')
if qita is not None:
paginator = Paginator(qita, 6) paginator = Paginator(qita, 6)
page = int(request.GET.get('page', 1)) page = int(request.GET.get('page', 1))
try: try:
@ -1064,7 +1116,6 @@ def newmedia_management_edit_qita(request):
qita = paginator.page(1) qita = paginator.page(1)
except EmptyPage: except EmptyPage:
qita = paginator.page(paginator.num_pages) qita = paginator.page(paginator.num_pages)
res = []
for w in qita: for w in qita:
o = dict() o = dict()
o['id'] = str(w.id) o['id'] = str(w.id)
@ -1089,7 +1140,8 @@ def newmedia_management_edit_qita(request):
Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str(
Area_code_2020.objects.get(code=w.organization.district).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.district).name) + '-' + str(
Area_code_2020.objects.get(code=w.organization.town).name) Area_code_2020.objects.get(code=w.organization.town).name)
elif len(w.organization.province) > 0 and len(w.organization.cities) > 0 and len(w.organization.district) > 0: elif len(w.organization.province) > 0 and len(w.organization.cities) > 0 and len(
w.organization.district) > 0:
o['administrativedivision'] = str( o['administrativedivision'] = str(
Area_code_2020.objects.get(code=w.organization.province).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.province).name) + '-' + str(
Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str( Area_code_2020.objects.get(code=w.organization.cities).name) + '-' + str(

View File

@ -1,12 +1,13 @@
# Django~=2.2.15 Django~=2.2.15
# django-bootstrap3 django-bootstrap3
# django-simple-captcha django-simple-captcha
# psycopg2-binary psycopg2-binary
# django-cors-headers django-cors-headers
# aliyun-python-sdk-core-v3 aliyun-python-sdk-core-v3
# channels channels
# requests requests
# parsel parsel
# django-summernote django-summernote
# python-dateutil python-dateutil
# channels_redis[cryptography] channels_redis[cryptography]
jieba