This commit is contained in:
baoliang 2020-09-18 14:03:55 +08:00
commit 3f5928a9cf
62 changed files with 4812 additions and 3391 deletions

View File

@ -47,6 +47,7 @@ INSTALLED_APPS = [
'monitor',
'polls',
'django_summernote',
'graph',
]
MIDDLEWARE = [

View File

@ -17,14 +17,21 @@ from django.contrib import admin
from django.urls import path, re_path, include
from django.conf import settings
from django.conf.urls.static import static
# from wagtail.admin import urls as wagtailadmin_urls
# from wagtail.documents import urls as wagtaildocs_urls
# from wagtail.core import urls as wagtail_urls
urlpatterns = [
path('polls/', include('polls.urls')),
# re_path(r'^cms/', include(wagtailadmin_urls)),
# re_path(r'^documents/', include(wagtaildocs_urls)),
# re_path(r'^pages/', include(wagtail_urls)),
path('admin/', admin.site.urls),
path('', include('dashboard.urls')),
path('captcha/', include('captcha.urls')),
path('management/', include('management.urls')),
path('monitor/', include('monitor.urls')),
path('summernote/', include('django_summernote.urls')),
path('graph/', include('graph.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

View File

@ -1,5 +1,4 @@
import uuid
from django_summernote.fields import SummernoteTextField
from django.contrib.auth.models import User
from django.db import models
@ -15,19 +14,19 @@ class Level(models.Model):
return self.name
class Group_type(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
type = models.CharField('群组类型', max_length=256, null=True, blank=True)
type = models.CharField('矩阵类型', max_length=256, null=True, blank=True)
def __str__(self):
return self.type
# 群组
# 矩阵
class Group(models.Model):
GROUP_STATUS_CHOICES = (
('0', '关闭'),
('1', '开启')
)
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
name = models.CharField('群组名称', max_length=256, null=True, blank=True)
presentation = models.TextField('群组描述', null=True, blank=True)
name = models.CharField('矩阵名称', max_length=256, null=True, blank=True)
presentation = models.TextField('矩阵描述', null=True, blank=True)
image = models.FileField(upload_to='groupimage', null=True, blank=True)
type = models.ForeignKey(
Group_type, on_delete=models.CASCADE, null=True, blank=True)
@ -38,6 +37,7 @@ class Group(models.Model):
district = models.CharField('', max_length=256, null=True, blank=True)
town = models.CharField('', max_length=256, null=True, blank=True)
village = models.CharField('', max_length=256, null=True, blank=True)
user = models.ForeignKey(User,on_delete=models.CASCADE,blank=True,null=True)
created = models.DateTimeField('创建时间', auto_now_add=True)
updated = models.DateTimeField('更新时间', auto_now=True)
@ -45,7 +45,7 @@ class Group(models.Model):
def __str__(self):
return self.name
# 群组管理员
# 矩阵管理员
class Group_admin(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
user = models.ForeignKey(
@ -57,7 +57,7 @@ class Group_admin(models.Model):
def __str__(self):
return self.group.name
# 群组成员
# 矩阵成员
class Group_user(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
user = models.ForeignKey(
@ -94,8 +94,8 @@ class Organization(models.Model):
district = models.CharField('', max_length=256, null=True, blank=True)
town = models.CharField('', max_length=256, null=True, blank=True)
village = models.CharField('', max_length=256, null=True, blank=True)
# group = models.ForeignKey(Group, on_delete=models.CASCADE, null=True, blank=True)
# level = models.ForeignKey(Level,on_delete=models.CASCADE,null=True,blank=True)
level = models.ForeignKey(Level,on_delete=models.CASCADE,null=True,blank=True)
directly = models.CharField('直属',max_length=256,null=True,blank=True)
created = models.DateTimeField('创建时间', auto_now_add=True)
updated = models.DateTimeField('更新时间', auto_now=True)
@ -171,7 +171,7 @@ class Weixin_data(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
title = models.CharField('文章标题', max_length=256, null=True, blank=True)
site = models.CharField('位置', max_length=256, null=True, blank=True)
date = models.CharField('发文时间', max_length=256, null=True, blank=True)
date = models.DateField('发文时间', max_length=256, null=True, blank=True)
original = models.BooleanField('是否原创', null=True, blank=True)
url = models.CharField('文章链接', max_length=256, null=True, blank=True)
author = models.CharField('作者', max_length=256, null=True, blank=True)
@ -235,7 +235,7 @@ class Weibo_data(models.Model):
'转发图片url', max_length=256, null=True, blank=True)
original = models.BooleanField('是否原创', null=True, blank=True)
site = models.CharField('发布位置', max_length=256, null=True, blank=True)
date = models.CharField('发布时间', max_length=256, null=True, blank=True)
date = models.DateField('发布时间', max_length=256, null=True, blank=True)
tool = models.CharField('发布工具', max_length=256, null=True, blank=True)
like = models.CharField('点赞数', max_length=256, null=True, blank=True)
transpond = models.CharField('转发数', max_length=256, null=True, blank=True)
@ -278,7 +278,7 @@ class Toutiao_data(models.Model):
commentcount = models.CharField(
'评论数', max_length=256, null=True, blank=True)
reply = models.CharField('作者回复数', max_length=256, null=True, blank=True)
date = models.CharField('时间', max_length=256, null=True, blank=True)
date = models.DateField('时间', max_length=256, null=True, blank=True)
content = models.TextField('正文', null=True, blank=True)
comment = models.TextField('评论', null=True, blank=True)
toutiao = models.ForeignKey(
@ -335,7 +335,7 @@ class Douyin_data(models.Model):
'监测时间内发文量', max_length=256, null=True, blank=True)
comment = models.CharField('评论数', max_length=256, null=True, blank=True)
reply = models.CharField('作者回复数', max_length=256, null=True, blank=True)
date = models.CharField('最近发文日期', max_length=256, null=True, blank=True)
date = models.DateField('最近发文日期', max_length=256, null=True, blank=True)
created = models.DateTimeField('创建时间', auto_now_add=True)
updated = models.DateTimeField('更新时间', auto_now=True)
@ -361,7 +361,7 @@ class Qita_jc(models.Model):
'监测时间内发文量', max_length=256, null=True, blank=True)
comment = models.CharField('评论数', max_length=256, null=True, blank=True)
reply = models.CharField('作者回复数', max_length=256, null=True, blank=True)
date = models.CharField('最近发文日期', max_length=256, null=True, blank=True)
date = models.DateField('最近发文日期', max_length=256, null=True, blank=True)
created = models.DateTimeField('创建时间', auto_now_add=True)
updated = models.DateTimeField('更新时间', auto_now=True)
@ -391,11 +391,12 @@ class News(models.Model):
)
id = models.UUIDField('id',primary_key=True,default=uuid.uuid4)
type = models.CharField('文章类型',max_length=256,null=True,blank=True,choices=NEWMEDIA_NEWS_CHOICES)
source = models.CharField('文章来源',max_length=256,null=True,blank=True)
title = models.CharField('文章标题',max_length=256,null=True,blank=True)
image = models.FileField(
upload_to='news/%Y/%m/%d/', null=True, blank=True)
author = models.CharField('作者',max_length=256,null=True,blank=True)
date = models.CharField('发表日期',null=True,blank=True,max_length=256)
date = models.DateField('发表日期',null=True,blank=True,max_length=256)
content = models.TextField('内容',null=True,blank=True)
def __str__(self):

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

View File

@ -35,7 +35,7 @@
<span class="title">新媒体舆情</span>
</a>
</li>
{# <li class="open">#}
{# <li class="open">#}
<li class="">
<a href="javascript:;">
<i class="fa fa-map-marker"></i>
@ -69,6 +69,12 @@
</li>
</ul>
</li>
<li class="">
<a href="">
<i class="fa fa-th"></i>
<span class="title">评论互动监测</span>
</a>
</li>
<li class="">
<a href="javascript:;">
<i class="fa fa-suitcase"></i>
@ -84,15 +90,15 @@
<li class="">
<a href="javascript:;">
<i class="fa fa-sliders"></i>
<span class="title">群组管理</span>
<span class="title">矩阵管理</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a class="" href="{% url 'group-management-create' %}">新建群组</a>
<a class="" href="{% url 'group-management-create' %}">新建矩阵</a>
</li>
<li>
<a class="" href="{% url 'group-management-management' %}">编辑群组</a>
<a class="" href="{% url 'group-management-management-init' %}">编辑矩阵</a>
</li>
<li>
<a class="" href="">搜索添加单位</a>
@ -125,10 +131,22 @@
<a class="" href="{% url 'organization-management-create' %}">新建单位</a>
</li>
<li>
<a class="" href="">搜索添加用户</a>
<a class="" href="{% url 'organization-management-management' %}">编辑单位</a>
</li>
</ul>
</li>
<li class="">
<a href="javascript:;">
<i class="fa fa-sliders"></i>
<span class="title">新闻管理</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a class="" href="{% url 'news-management-create' %}">发布新闻</a>
</li>
<li>
<a class="" href="{% url 'organization-management-management' %}">编辑单位</a>
<a class="" href="{% url 'new-management' %}">新闻管理</a>
</li>
</ul>
</li>

View File

@ -78,7 +78,7 @@
<section class="box nobox">
<div class="content-body">
<div class="row">
<div class="col-md-3 col-sm-6 col-xs-6">
<div class="col-md-2 col-sm-6 col-xs-6">
<div class="r4_counter db_box">
{# <i class='pull-left fa fa-thumbs-up icon-md icon-rounded icon-primary'></i>#}
<img src="{% static 'dashboard/image/weixin.png' %}"
@ -89,7 +89,7 @@
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-6">
<div class="col-md-2 col-sm-6 col-xs-6">
<div class="r4_counter db_box">
{# <i class='pull-left fa fa-shopping-cart icon-md icon-rounded icon-orange'></i>#}
<img src="{% static 'dashboard/image/weibo.png' %}"
@ -100,7 +100,7 @@
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-6">
<div class="col-md-2 col-sm-6 col-xs-6">
<div class="r4_counter db_box">
{# <i class='pull-left fa fa-dollar icon-md icon-rounded icon-purple'></i>#}
<img src="{% static 'dashboard/image/toutiao.png' %}"
@ -111,7 +111,18 @@
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-6">
<div class="col-md-2 col-sm-6 col-xs-6">
<div class="r4_counter db_box">
{# <i class='pull-left fa fa-dollar icon-md icon-rounded icon-purple'></i>#}
<img src="{% static 'dashboard/image/douyin.jpg' %}"
class='pull-left fa fa-thumbs-up '>
<div class="stats">
<h4><strong>{{ douyin_count }}</strong></h4>
<span>抖音</span>
</div>
</div>
</div>
<div class="col-md-2 col-sm-6 col-xs-6">
<div class="r4_counter db_box">
{# <i class='pull-left fa fa-users icon-md icon-rounded icon-warning'></i>#}
<img src="{% static 'dashboard/image/qita.png' %}"
@ -122,16 +133,27 @@
</div>
</div>
</div>
<div class="col-md-2 col-sm-6 col-xs-6">
<div class="r4_counter db_box">
{# <i class='pull-left fa fa-users icon-md icon-rounded icon-warning'></i>#}
<img src="{% static 'dashboard/image/shuliang.jpg' %}"
class='pull-left fa fa-thumbs-up '>
<div class="stats">
<h4><strong>{{ organization_count }}</strong></h4>
<span>注册单位</span>
</div>
</div>
</div>
</div> <!-- End .row -->
<div class="row">
<div class="col-md-3 col-sm-5 col-xs-12">
<div class="col-md-6 col-sm-7 col-xs-12">
<div class="r1_graph1 db_box">
<span class='bold'>98.95%</span>
<span class='pull-right'><small>SERVER UP</small></span>
<div class="clearfix"></div>
<span class="db_dynamicbar">Loading...</span>
<span id="date-count" style="width: 150%;height: 60px;">Loading...</span>
</div>
@ -173,30 +195,30 @@
</div>
</div>
<div class="col-md-3 col-sm-12 col-xs-12">
<div class="r1_graph4 db_box">
<span class=''>
<i class='icon-purple fa fa-square icon-xs icon-1'></i>&nbsp;<small>CPU USAGE</small>
</span>
<canvas width='180' height='90' id="gauge-meter"></canvas>
<h4 id='gauge-meter-text'></h4>
</div>
<div class="r1_graph5 db_box col-xs-6">
<span class=''><i class='icon-purple fa fa-square icon-xs icon-1'></i>&nbsp;<small>LONDON</small>&nbsp; &nbsp;<i
class='fa fa-square icon-xs icon-2'></i>&nbsp;<small>PARIS</small></span>
<div style="width:120px;height:120px;margin: 0 auto;">
<span class="db_easypiechart1 easypiechart" data-percent="66"><span
class="percent" style='line-height:120px;'></span></span>
</div>
</div>
</div>
{# <div class="col-md-3 col-sm-12 col-xs-12">#}
{# <div class="r1_graph4 db_box">#}
{# <span class=''>#}
{# <i class='icon-purple fa fa-square icon-xs icon-1'></i>&nbsp;<small>CPU USAGE</small>#}
{# </span>#}
{# <canvas width='180' height='90' id="gauge-meter"></canvas>#}
{# <h4 id='gauge-meter-text'></h4>#}
{# </div>#}
{# <div class="r1_graph5 db_box col-xs-6">#}
{# <span class=''><i class='icon-purple fa fa-square icon-xs icon-1'></i>&nbsp;<small>LONDON</small>&nbsp; &nbsp;<i#}
{# class='fa fa-square icon-xs icon-2'></i>&nbsp;<small>PARIS</small></span>#}
{# <div style="width:120px;height:120px;margin: 0 auto;">#}
{# <span class="db_easypiechart1 easypiechart" data-percent="66"><span#}
{# class="percent" style='line-height:120px;'></span></span>#}
{# </div>#}
{# </div>#}
{##}
{# </div>#}
</div> <!-- End .row -->
<div class="row">
<div class="col-md-8 col-sm-12 col-xs-12">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="wid-vectormap">
<h4>Visitor's Statistics</h4>
<div class="row">
@ -235,82 +257,82 @@
</div>
</div>
<div class="col-md-4 col-sm-12 col-xs-12">
<div class="r2_graph1 db_box">
<form id="rickshaw_side_panel">
<section>
<div id="legend"></div>
</section>
<section>
<div id="renderer_form" class="toggler">
<select name="renderer">
<option value="area" selected>Area</option>
<option value="bar">Bar</option>
<option value="line">Line</option>
<option value="scatterplot">Scatter</option>
</select>
</div>
</section>
<section>
<div id="offset_form">
<label for="stack">
<input type="radio" name="offset" id="stack" value="zero"
checked>
<span>stack</span>
</label>
<label for="stream">
<input type="radio" name="offset" id="stream" value="wiggle">
<span>stream</span>
</label>
<label for="pct">
<input type="radio" name="offset" id="pct" value="expand">
<span>pct</span>
</label>
<label for="value">
<input type="radio" name="offset" id="value" value="value">
<span>value</span>
</label>
</div>
<div id="interpolation_form">
<label for="cardinal">
<input type="radio" name="interpolation" id="cardinal"
value="cardinal" checked>
<span>cardinal</span>
</label>
<label for="linear">
<input type="radio" name="interpolation" id="linear"
value="linear">
<span>linear</span>
</label>
<label for="step">
<input type="radio" name="interpolation" id="step"
value="step-after">
<span>step</span>
</label>
</div>
</section>
</form>
<div id="chart_container" class="rickshaw_ext">
<div id="chart"></div>
<div id="timeline"></div>
</div>
<div id='rickshaw_side_panel' class="rickshaw_sliders">
<section>
<h5>Smoothing</h5>
<div id="smoother"></div>
</section>
<section>
<h5>Preview Range</h5>
<div id="preview" class="rickshaw_ext_preview"></div>
</section>
</div>
</div>
</div>
{# <div class="col-md-4 col-sm-12 col-xs-12">#}
{# <div class="r2_graph1 db_box">#}
{##}
{##}
{# <form id="rickshaw_side_panel">#}
{# <section>#}
{# <div id="legend"></div>#}
{# </section>#}
{# <section>#}
{# <div id="renderer_form" class="toggler">#}
{# <select name="renderer">#}
{# <option value="area" selected>Area</option>#}
{# <option value="bar">Bar</option>#}
{# <option value="line">Line</option>#}
{# <option value="scatterplot">Scatter</option>#}
{# </select>#}
{# </div>#}
{# </section>#}
{# <section>#}
{# <div id="offset_form">#}
{# <label for="stack">#}
{# <input type="radio" name="offset" id="stack" value="zero"#}
{# checked>#}
{# <span>stack</span>#}
{# </label>#}
{# <label for="stream">#}
{# <input type="radio" name="offset" id="stream" value="wiggle">#}
{# <span>stream</span>#}
{# </label>#}
{# <label for="pct">#}
{# <input type="radio" name="offset" id="pct" value="expand">#}
{# <span>pct</span>#}
{# </label>#}
{# <label for="value">#}
{# <input type="radio" name="offset" id="value" value="value">#}
{# <span>value</span>#}
{# </label>#}
{# </div>#}
{# <div id="interpolation_form">#}
{# <label for="cardinal">#}
{# <input type="radio" name="interpolation" id="cardinal"#}
{# value="cardinal" checked>#}
{# <span>cardinal</span>#}
{# </label>#}
{# <label for="linear">#}
{# <input type="radio" name="interpolation" id="linear"#}
{# value="linear">#}
{# <span>linear</span>#}
{# </label>#}
{# <label for="step">#}
{# <input type="radio" name="interpolation" id="step"#}
{# value="step-after">#}
{# <span>step</span>#}
{# </label>#}
{# </div>#}
{# </section>#}
{# </form>#}
{##}
{# <div id="chart_container" class="rickshaw_ext">#}
{# <div id="chart"></div>#}
{# <div id="timeline"></div>#}
{# </div>#}
{##}
{# <div id='rickshaw_side_panel' class="rickshaw_sliders">#}
{# <section>#}
{# <h5>Smoothing</h5>#}
{# <div id="smoother"></div>#}
{# </section>#}
{# <section>#}
{# <h5>Preview Range</h5>#}
{# <div id="preview" class="rickshaw_ext_preview"></div>#}
{# </section>#}
{# </div>#}
{##}
{# </div>#}
{# </div>#}
</div> <!-- End .row -->
</div>
@ -555,6 +577,16 @@
<script src="{% static 'js/gauge.min.js' %}" type="text/javascript"></script>
<script src="{% static 'js/icheck.min.js' %}" type="text/javascript"></script>
<script src="{% static 'js/dashboard.js' %}" type="text/javascript"></script>
<script src="{% static 'graph/js/echarts.min.js' %}" type="text/javascript"></script>
<script src="{% static 'graph/js/data-count.js' %}" type="text/javascript"></script>
<script>
$(function () {
var year = '{{ year }}';
var month_form = '{{ month_from }}';
var month_to = '{{ month_to }}';
initChart('date-count',year,month_form, month_to);
})
</script>
{% endblock %}

View File

@ -0,0 +1,18 @@
<div id="pages" class="text-center">
<nav>
<ul class="pagination">
<li class="step-links">
{% if douyin.has_previous %}
<a class='active' href="?page={{ douyin.previous_page_number }}">上一页</a>
{% endif %}
<span class="current">
第{{ douyin.number }}页 共{{ douyin.paginator.num_pages }}页</span>
{% if toutiao.has_next %}
<a class='active' href="?page={{ douyin.next_page_number }}">下一页</a>
{% endif %}
</li>
</ul>
</nav>
</div>

View File

@ -59,7 +59,7 @@
<form name="loginform" id="loginform" action="{% url 'dashboard-register' %}" method="post"
enctype="multipart/form-data">{% csrf_token %}
<p>
<p style="display: inline-block">
<label for="name">单位<br/>
<select class="form-control" name="organization">
{% for o in organization %}
@ -68,6 +68,7 @@
</select>
</label>
</p>
<a href="{% url 'organization-management-create' %}"><span class="glyphicon glyphicon-plus" aria-hidden="true" style="margin-left: 40px"></span></a>
<p>
<label for="name">姓名<br/>
<input type="text" name="name" id="user_login" class="input" value="" size="20"/></label>

View File

@ -17,5 +17,5 @@ urlpatterns = [
path('get/district/',views.get_district),
path('get/town/',views.get_town),
path('get/village/',views.get_village),
path('add/news/',views.add_news,name='add-news'),
]

View File

@ -1,5 +1,6 @@
from captcha.helpers import captcha_image_url
from captcha.models import CaptchaStore
from dateutil import relativedelta
from django.contrib import messages
from django.contrib.auth import logout, authenticate, login
from django.contrib.auth.models import User
@ -8,9 +9,8 @@ from django.http import HttpResponseRedirect, JsonResponse
from django.shortcuts import render
import datetime
# Create your views here.
from dashboard.models import Userprofile, Organization, Area_code_2020, Weixin, Weibo, Toutiao, Qita, News
from dashboard.models import Userprofile, Organization, Area_code_2020, Weixin, Weibo, Toutiao, Qita, News, Douyin
def refresh_captcha(request):
@ -19,12 +19,23 @@ def refresh_captcha(request):
to_json_response['new_cptch_key'] = CaptchaStore.generate_key()
to_json_response['new_cptch_image'] = captcha_image_url(to_json_response['new_cptch_key'])
return JsonResponse(to_json_response)
def index(request):
weixin_count = Weixin.objects.all().count()
weibo_count = Weibo.objects.all().count()
toutiao_count = Toutiao.objects.all().count()
qita_count = Qita.objects.all().count()
return render(request,'dashboard/index.html',{'weixin_count':weixin_count,'weibo_count':weibo_count,'toutiao_count':toutiao_count,'qita_count':qita_count})
douyin_count = Douyin.objects.all().count()
organization_count = Organization.objects.all().count()
year = datetime.datetime.now().year
month_from = datetime.datetime.now().month
month_to = int(month_from)-1
return render(request, 'dashboard/index.html',
{'weixin_count': weixin_count, 'weibo_count': weibo_count, 'toutiao_count': toutiao_count,
'qita_count': qita_count, 'douyin_count': douyin_count, 'organization_count': organization_count,'year':year,'month_from':month_from,'month_to':month_to})
def user_login(request):
username = None
password = None
@ -48,7 +59,7 @@ def user_login(request):
except CaptchaStore.DoesNotExist:
messages.error(request, '验证码错误')
return HttpResponseRedirect('/login/')
print(username,password)
print(username, password)
if username is not None and password is not None:
try:
user = authenticate(username=username, password=password)
@ -63,10 +74,14 @@ def user_login(request):
messages.error(request, '账号或密码错误,请您确认账号和密码')
except:
messages.error(request, '账号或密码错误,请您确认账号和密码')
return render(request,'dashboard/login.html',{'hash_key':hash_key,'image_url':image_url})
return render(request, 'dashboard/login.html', {'hash_key': hash_key, 'image_url': image_url})
def user_logout(request):
logout(request)
return HttpResponseRedirect('/')
def register(request):
username = None
email = None
@ -115,7 +130,7 @@ def register(request):
messages.error(request, '请选择头像')
else:
image = request.FILES.get('image')
print(str(image)+"1111111111111111111111111111111111111111111")
print(str(image) + "1111111111111111111111111111111111111111111")
if request.POST.get('sex') == '1':
sex = ''
elif request.POST.get('sex') == '2':
@ -141,41 +156,49 @@ def register(request):
return HttpResponseRedirect('/register/')
if username is not None and password is not None and confirm_password is not None and email is not None and flag:
user = User.objects.create_user(username,email,password)
user = User.objects.create_user(username, email, password)
user.is_active = True
# user.is_staff = True
# user.first_name = phone
user.save()
userprofile = Userprofile(name=name,image=image,user_id=user.id,organization_id=o,sex=sex,status=0)
userprofile = Userprofile(name=name, image=image, user_id=user.id, organization_id=o, sex=sex, status=0)
userprofile.save()
messages.success(request, '注册成功,请登录')
return HttpResponseRedirect('/login/')
return render(request, 'dashboard/register.html', {'hash_key': hash_key, 'image_url': image_url,'organization':organization})
return render(request, 'dashboard/register.html',
{'hash_key': hash_key, 'image_url': image_url, 'organization': organization})
def get_province(request):
#
#
province = Area_code_2020.objects.filter(level=1)
res = []
for i in province:
res.append([i.code,i.name,i.level,i.pcode])
return JsonResponse({"province":res})
res.append([i.code, i.name, i.level, i.pcode])
return JsonResponse({"province": res})
def get_city(request):
code = request.GET.get('code')
print(code)
#
#
cities = Area_code_2020.objects.filter(pcode=code)
res = []
for i in cities:
res.append([i.code,i.name,i.level,i.pcode])
res.append([i.code, i.name, i.level, i.pcode])
return JsonResponse({"city": res})
def get_district(request):
code = request.GET.get('code')
#
#
district = Area_code_2020.objects.filter(pcode=code)
res = []
for i in district:
res.append([i.code, i.name, i.level, i.pcode])
return JsonResponse({"district": res})
def get_town(request):
code = request.GET.get('code')
# 乡
@ -184,6 +207,8 @@ def get_town(request):
for i in town:
res.append([i.code, i.name, i.level, i.pcode])
return JsonResponse({"town": res})
def get_village(request):
code = request.GET.get('code')
# 村
@ -192,24 +217,6 @@ def get_village(request):
for i in village:
res.append([i.code, i.name, i.level, i.pcode])
return JsonResponse({"village": res})
def add_news(request):
if request.method == 'POST':
type = request.POST.get('type')
title = request.POST.get('title')
author = request.POST.get('author')
date = request.POST.get('date')
content = request.POST.get('content')
print(str(title), str(content))
news = News(type = type,title=title, author=author, date=date, content=content)
news.save()
messages.success(request, '添加成功!!!')
return HttpResponseRedirect('/add/news/')
type = News.NEWMEDIA_NEWS_CHOICES
results = []
for i in type:
o = dict()
o['choices'] = list(i)[0]
results.append(o)
return render(request,'dashboard/add_news.html',{'type':results})

0
graph/__init__.py Normal file
View File

3
graph/admin.py Normal file
View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

5
graph/apps.py Normal file
View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class GraphConfig(AppConfig):
name = 'graph'

3
graph/models.py Normal file
View File

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

View File

@ -0,0 +1,41 @@
function initChart (element,year,month_from,month_to) {
var dataCount = echarts.init(document.getElementById(element));
var dataCountOption = {
color: ['#3398DB'],
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {
// left: '3%',
// right: '4%',
// bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
axisTick: {
alignWithLabel: true
}
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '直接访问',
type: 'bar',
barWidth: '60%',
data: [10, 52, 200, 334, 390, 330, 220]
}
]
};
dataCount.setOption(dataCountOption)
}

22
graph/static/graph/js/echarts.min.js vendored Normal file

File diff suppressed because one or more lines are too long

3
graph/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

8
graph/urls.py Normal file
View File

@ -0,0 +1,8 @@
from django.contrib import admin
from django.urls import path
from dashboard import views
urlpatterns = [
]

9
graph/views.py Normal file
View File

@ -0,0 +1,9 @@
import datetime
from django.shortcuts import render
# Create your views here.
def index_data_count_chart(request):
pass

View File

@ -2727,7 +2727,7 @@
if (this.options.connect && this.connect.length) {
this.index = this.find(this.options.toggle).index(active);
this.index = this.find(this.options.toggle).data(active);
if (this.index == -1 ) {
this.index = 0;
@ -2781,7 +2781,7 @@
var anim = ['@-animation-slide-top', '@-animation-slide-bottom'];
if (current && current.index() > next.index()) {
if (current && current.data() > next.data()) {
anim.reverse();
}
@ -2800,7 +2800,7 @@
var anim = ['@-animation-slide-left', '@-animation-slide-right'];
if (current && current.index() > next.index()) {
if (current && current.data() > next.data()) {
anim.reverse();
}
@ -2928,7 +2928,7 @@
var link = $(this);
$this.element.children(':not(.@-tab-responsive)').eq(link.data('index')).trigger('click');
$this.element.children(':not(.@-tab-responsive)').eq(link.data('data-count.js')).trigger('click');
});
this.on('show.uk.switcher change.uk.tab', function(e, tab) {

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,196 @@
{% 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">&times;</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 'group-management-update' group.id %}" enctype="multipart/form-data">{% csrf_token %}
<div class="form-group">
<label class="form-label" for="name">矩阵名称</label>
<div class="controls">
<input type="text" class="form-control" name="name"
value="{{ group.name }}">
</div>
</div>
<div class="form-group">
<label class="form-label" for="presentation">矩阵介绍</label>
<div class="controls">
<input type="text" class="form-control"
name="presentation" value="{{ group.presentation }}">
</div>
</div>
<div class="form-group">
<label class="form-label" for="image">图标
<div class="controls">
<input type="file" name="image"><img
src="{{ group.image.url }}"
style="width: 80px;height: 80px;"
class="img-circle">
</div>
</label>
</div>
<div class="form-group">
<label class="form-label" for="type">矩阵类型</label>
<div class="controls">
<select class="form-control" name="type">
<option value="{{ group.type.id }}">{{ group.type }}</option>
{% for g in group_type %}
<option value="{{ g.id }}">{{ g.type }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group">
<label class="form-label" for="status">矩阵状态</label>
<div class="controls">
<select class="form-control" name="status">
<option value="{{ group.status }}">{{ group.status }}</option>
{% for g in group_status_choices_list %}
<option value="{{ g }}">{{ g }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group">
<label class="form-label" for="administrativedivision">行政区划</label>
<div class="controls">
<select id="province" name="province">
<option value="{{ group.province }}">{{ group.province }}</option>
</select>
<select id="city" name="city" style="margin-left: 20px">
<option value="{{ group.cities }}">{{ group.cities }}</option>
</select>
<select id="district" name="district" style="margin-left: 20px">
<option value="{{ group.district }}">{{ group.district }}</option>
</select>
<select id="town" name="town" style="margin-left: 20px">
<option value="{{ group.town }}">{{ group.town }}</option>
</select>
<select id="village" name="village" style="margin-left: 20px">
<option value="{{ group.village }}">{{ group.village }}</option>
</select>
</div>
</div>
<div class="form-group">
<label class="form-label" for="stauts">管理员</label>
<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>
<table class="table table-hover" style="margin-top: 20px">
<thead>
<tr>
<th style="text-align: center">头像</th>
<th style="text-align: center">用户名</th>
<th style="text-align: center">姓名</th>
<th style="text-align: center">单位名称</th>
<th style="text-align: center">行政区划</th>
<th style="text-align: center">操作</th>
</tr>
</thead>
<tbody>
{% for g_a in g_a_list %}
<tr>
<td style="vertical-align: middle;text-align: center"><img
src="{{ g_a.image }}"
style="width: 80px;height: 80px;"
class="img-circle"></td>
<td style="vertical-align: middle;text-align: center">{{ g_a.username }}</td>
<td style="vertical-align: middle;text-align: center">{{ g_a.name }}</td>
<td style="vertical-align: middle;text-align: center">{{ g_a.organization }}</td>
<td style="vertical-align: middle;text-align: center">{{ g_a.administrativedivision }}</td>
<td style="vertical-align: middle;text-align: center">
<a href="{% url 'group-admin-delete' g_a.id group.id %}"
class="btn btn-danger btn-mini">删除</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="form-group">
<label class="form-label" for="stauts">成员</label>
<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>
<table class="table table-hover" style="margin-top: 20px">
<thead>
<tr>
<th style="text-align: center">头像</th>
<th style="text-align: center">用户名</th>
<th style="text-align: center">姓名</th>
<th style="text-align: center">单位名称</th>
<th style="text-align: center">行政区划</th>
<th style="text-align: center">操作</th>
</tr>
</thead>
<tbody>
{% for g_u in g_u_list %}
<tr>
<td style="vertical-align: middle;text-align: center"><img
src="{{ g_u.image }}"
style="width: 80px;height: 80px;"
class="img-circle"></td>
<td style="vertical-align: middle;text-align: center">{{ g_u.username }}</td>
<td style="vertical-align: middle;text-align: center">{{ g_u.name }}</td>
<td style="vertical-align: middle;text-align: center">{{ g_u.organization }}</td>
<td style="vertical-align: middle;text-align: center">{{ g_u.administrativedivision }}</td>
<td style="vertical-align: middle;text-align: center">
<a href="{% url 'group-user-delete' g_u.id group.id %}"
class="btn btn-danger btn-mini">删除</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<button type="submit" class="btn btn-success">提交</button>
</form>
</div>
</div>
</div>
</section>
</div>
</section>
</section>
<div class="chatapi-windows "></div>
</div>
</body>
{% endblock %}

View File

@ -27,7 +27,7 @@
<div class="page-title">
<div class="pull-left">
<h1 class="title">添加群组管理员</h1></div>
<h1 class="title">添加矩阵管理员</h1></div>
</div>
</div>
<div class="clearfix"></div>
@ -35,7 +35,7 @@
<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>
<h2 class="title pull-left">矩阵管理员表单</h2>
</header>
<div class="content-body">
<div class="row">
@ -43,7 +43,7 @@
<form method="post"
action="{% url 'group-admin-create' pk %}" enctype="multipart/form-data">{% csrf_token %}
<div class="form-group">
<label class="form-label" for="name">群组名称</label>
<label class="form-label" for="name">矩阵名称</label>
<div class="controls">
<input type="text" class="form-control" name="name" disabled value="{{ group }}">
</div>

View File

@ -30,7 +30,7 @@
<div class="page-title">
<div class="pull-left">
<h1 class="title">群组管理</h1></div>
<h1 class="title">矩阵管理</h1></div>
</div>
@ -41,7 +41,12 @@
<div class="col-lg-12">
<section class="box ">
<header class="panel_header">
<h2 class="title pull-left">群组列表</h2>
{# <h2 class="title pull-left">矩阵列表</h2>#}
<ul class="nav nav-pills">
<li role="presentation"><a href="{% url 'group-management-management-init' %}">我创建的矩阵</a></li>
<li role="presentation" class="active"><a href="{% url 'group-management-management-admin' %}">我管理的矩阵</a></li>
<li role="presentation"><a href="{% url 'group-management-management-user' %}">我加入的矩阵</a></li>
</ul>
</header>
<div class="content-body">
<div class="row">
@ -50,8 +55,8 @@
<thead>
<tr>
<th style="text-align: center">头像</th>
<th style="text-align: center">群组名称</th>
<th style="text-align: center">群组类型</th>
<th style="text-align: center">矩阵名称</th>
<th style="text-align: center">矩阵类型</th>
<th style="text-align: center">管理员个数</th>
<th style="text-align: center">成员个数</th>
<th style="text-align: center">状态</th>
@ -59,7 +64,7 @@
</tr>
</thead>
<tbody>
{% for r in res %}
{% for r in res_g_a %}
<tr>
<td><img src="{{ r.image }}" style="width: 80px;height: 80px;"
class="img-circle"></td>

View File

@ -27,7 +27,7 @@
<div class="page-title">
<div class="pull-left">
<h1 class="title">新建群组</h1></div>
<h1 class="title">新建矩阵</h1></div>
</div>
</div>
<div class="clearfix"></div>
@ -35,7 +35,7 @@
<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>
<h2 class="title pull-left">矩阵信息表单</h2>
{# <div class="actions panel_actions pull-right">#}
{# <i class="box_toggle fa fa-chevron-down"></i>#}
{# <i class="box_setting fa fa-cog" data-toggle="modal" href="#section-settings"></i>#}
@ -48,13 +48,13 @@
<form method="post"
action="{% url 'group-management-create' %}" enctype="multipart/form-data">{% csrf_token %}
<div class="form-group">
<label class="form-label" for="name">群组名称</label>
<label class="form-label" for="name">矩阵名称</label>
<div class="controls">
<input type="text" class="form-control" name="name">
</div>
</div>
<div class="form-group">
<label class="form-label" for="presentation">群组介绍</label>
<label class="form-label" for="presentation">矩阵介绍</label>
<div class="controls">
<textarea type="text" class="form-control"
name="presentation"></textarea>
@ -68,7 +68,7 @@
</label>
</div>
<div class="form-group">
<label class="form-label" for="type">群组类型</label>
<label class="form-label" for="type">矩阵类型</label>
<div class="controls">
<select class="form-control" name="type">
{% for g in group_type %}
@ -78,7 +78,7 @@
</div>
</div>
<div class="form-group">
<label class="form-label" for="status">群组状态</label>
<label class="form-label" for="status">矩阵状态</label>
<div class="controls">
<select class="form-control" name="status">
{% for g in group_status_choices_list %}

View File

@ -0,0 +1,104 @@
{% extends 'dashboard/base/base.html' %}
{% load static %}
{% block css %}
<!-- OTHER SCRIPTS INCLUDED ON THIS PAGE - START -->
<link href="{% static 'management/css/uikit.min.css' %}" rel="stylesheet" type="text/css" media="screen"/>
<link href="{% static 'management/css/nestable.min.css' %}" rel="stylesheet" type="text/css" media="screen"/>
<!-- OTHER SCRIPTS INCLUDED ON THIS PAGE - END -->
{% endblock %}
{% block content %}
<body class=" "><!-- START TOPBAR -->
<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">&times;</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">
<section class="box ">
<header class="panel_header">
{# <h2 class="title pull-left">矩阵列表</h2>#}
<ul class="nav nav-pills">
<li role="presentation" class="active"><a href="{% url 'group-management-management-init' %}">我创建的矩阵</a></li>
<li role="presentation"><a href="{% url 'group-management-management-admin' %}">我管理的矩阵</a></li>
<li role="presentation"><a href="{% url 'group-management-management-user' %}">我加入的矩阵</a></li>
</ul>
</header>
<div class="content-body">
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<table class="table table-hover">
<thead>
<tr>
<th style="text-align: center">头像</th>
<th style="text-align: center">矩阵名称</th>
<th style="text-align: center">矩阵类型</th>
<th style="text-align: center">管理员个数</th>
<th style="text-align: center">成员个数</th>
<th style="text-align: center">状态</th>
<th style="text-align: center">操作</th>
</tr>
</thead>
<tbody>
{% for r in res_g_i %}
<tr>
<td><img src="{{ r.image }}" style="width: 80px;height: 80px;"
class="img-circle"></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.admin_count }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.admin_count }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.status }}</td>
<td style="vertical-align: middle;text-align: center">
<a href="{% url 'group-management-update' r.id %}"
class="btn btn-primary btn-mini">编辑</a>
<a href="{% url 'group-management-delete' r.id %}"
class="btn btn-danger btn-mini">删除</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/group-management-paginate.html' %}
</div>
</div>
</div>
</div>
</section>
</div>
</section>
</section>
<div class="chatapi-windows ">
</div>
</div>
</body>
{% endblock %}
{% block add_js %}
<script src="{% static 'management/js/uikit.min.js' %}" type="text/javascript"></script>
<script src="{% static 'management/js/nestable.min.js' %}" type="text/javascript"></script>
{% endblock %}

View File

@ -27,7 +27,7 @@
<div class="page-title">
<div class="pull-left">
<h1 class="title">编辑群组</h1></div>
<h1 class="title">编辑矩阵</h1></div>
</div>
</div>
<div class="clearfix"></div>
@ -35,7 +35,7 @@
<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>
<h2 class="title pull-left">矩阵信息表单</h2>
</header>
<div class="content-body">
<div class="row">
@ -43,14 +43,14 @@
<form method="post"
action="{% url 'group-management-update' group.id %}" enctype="multipart/form-data">{% csrf_token %}
<div class="form-group">
<label class="form-label" for="name">群组名称</label>
<label class="form-label" for="name">矩阵名称</label>
<div class="controls">
<input type="text" class="form-control" name="name"
value="{{ group.name }}">
</div>
</div>
<div class="form-group">
<label class="form-label" for="presentation">群组介绍</label>
<label class="form-label" for="presentation">矩阵介绍</label>
<div class="controls">
<input type="text" class="form-control"
name="presentation" value="{{ group.presentation }}">
@ -67,7 +67,7 @@
</label>
</div>
<div class="form-group">
<label class="form-label" for="type">群组类型</label>
<label class="form-label" for="type">矩阵类型</label>
<div class="controls">
<select class="form-control" name="type">
<option value="{{ group.type.id }}">{{ group.type }}</option>
@ -78,7 +78,7 @@
</div>
</div>
<div class="form-group">
<label class="form-label" for="status">群组状态</label>
<label class="form-label" for="status">矩阵状态</label>
<div class="controls">
<select class="form-control" name="status">
<option value="{{ group.status }}">{{ group.status }}</option>

View File

@ -0,0 +1,97 @@
{% extends 'dashboard/base/base.html' %}
{% load static %}
{% block css %}
<!-- OTHER SCRIPTS INCLUDED ON THIS PAGE - START -->
<link href="{% static 'management/css/uikit.min.css' %}" rel="stylesheet" type="text/css" media="screen"/>
<link href="{% static 'management/css/nestable.min.css' %}" rel="stylesheet" type="text/css" media="screen"/>
<!-- OTHER SCRIPTS INCLUDED ON THIS PAGE - END -->
{% endblock %}
{% block content %}
<body class=" "><!-- START TOPBAR -->
<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">&times;</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">
<section class="box ">
<header class="panel_header">
{# <h2 class="title pull-left">矩阵列表</h2>#}
<ul class="nav nav-pills">
<li role="presentation"><a href="{% url 'group-management-management-init' %}">我创建的矩阵</a></li>
<li role="presentation"><a href="{% url 'group-management-management-admin' %}">我管理的矩阵</a></li>
<li role="presentation" class="active"><a href="{% url 'group-management-management-user' %}">我加入的矩阵</a></li>
</ul>
</header>
<div class="content-body">
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<table class="table table-hover">
<thead>
<tr>
<th style="text-align: center">头像</th>
<th style="text-align: center">矩阵名称</th>
<th style="text-align: center">矩阵类型</th>
<th style="text-align: center">管理员个数</th>
<th style="text-align: center">成员个数</th>
<th style="text-align: center">状态</th>
</tr>
</thead>
<tbody>
{% for r in res_g_u %}
<tr>
<td><img src="{{ r.image }}" style="width: 80px;height: 80px;"
class="img-circle"></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.admin_count }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.admin_count }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.status }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/group-management-paginate.html' %}
</div>
</div>
</div>
</div>
</section>
</div>
</section>
</section>
<div class="chatapi-windows ">
</div>
</div>
</body>
{% endblock %}
{% block add_js %}
<script src="{% static 'management/js/uikit.min.js' %}" type="text/javascript"></script>
<script src="{% static 'management/js/nestable.min.js' %}" type="text/javascript"></script>
{% endblock %}

View File

@ -27,7 +27,7 @@
<div class="page-title">
<div class="pull-left">
<h1 class="title">添加群组成员</h1></div>
<h1 class="title">添加矩阵成员</h1></div>
</div>
</div>
<div class="clearfix"></div>
@ -35,7 +35,7 @@
<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>
<h2 class="title pull-left">矩阵成员表单</h2>
</header>
<div class="content-body">
<div class="row">
@ -43,7 +43,7 @@
<form method="post"
action="{% url 'group-user-create' pk %}" enctype="multipart/form-data">{% csrf_token %}
<div class="form-group">
<label class="form-label" for="name">群组名称</label>
<label class="form-label" for="name">矩阵名称</label>
<div class="controls">
<input type="text" class="form-control" name="name" disabled value="{{ group }}">
</div>

View File

@ -0,0 +1,105 @@
{% 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">&times;</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 'newmedia-management-create-douyin' %}"
enctype="multipart/form-data">{% csrf_token %}
<div class="form-group">
<label class="form-label" for="code">抖音号</label>
<div class="controls">
<input type="text" class="form-control" name="code">
</div>
</div>
<div class="form-group">
<label class="form-label" for="douyinid">ID</label>
<div class="controls">
<input type="text" class="form-control" name="douyinid">
</div>
</div>
<div class="form-group">
<label class="form-label" for="alias">别名</label>
<div class="controls">
<input type="text" class="form-control" name="alias">
</div>
</div>
<div class="form-group">
<label class="form-label" for="organization">单位</label>
<div class="controls">
<select class="form-control" name="organization">
{% for o in organization %}
<option value="{{ o.id }}">{{ o.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group">
<label class="form-label" for="image">图标
<div class="controls">
<input type="file" name="image">
</div>
</label>
</div>
<div class="form-group">
<label class="form-label" for="status">状态</label>
<div class="controls">
<select class="form-control" name="status">
{% for w in douyin_status_choices_list %}
<option value="{{ w }}">{{ w }}</option>
{% endfor %}
</select>
</div>
</div>
<button type="submit" class="btn btn-success" style="margin-top: 50px">点击新建
</button>
</form>
</div>
</div>
</div>
</section>
</div>
</section>
</section>
<div class="chatapi-windows "></div>
</div>
</body>
{% endblock %}

View File

@ -83,6 +83,16 @@
<a href="{% url 'newmedia-management-create-toutiao' %}"><span>今日头条</span></a>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-6 c">
<div class="r4_counter db_box">
<a href="{% url 'newmedia-management-create-douyin' %}"><img
src="{% static 'dashboard/image/douyin.jpg' %}"
class='fa fa-thumbs-up '></a>
</div>
<div class="stats">
<a href="{% url 'newmedia-management-create-douyin' %}"><span>抖音</span></a>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-6 c">
<div class="r4_counter db_box">
<a href="{% url 'newmedia-management-create-qita' %}"><img src="{% static 'dashboard/image/qita.png' %}"

View File

@ -0,0 +1,84 @@
{% extends 'dashboard/base/base.html' %}
{% load static %}
{% block css %}
<link href="{% static 'management/css/uikit.min.css' %}" rel="stylesheet" type="text/css" media="screen"/>
<link href="{% static 'management/css/nestable.min.css' %}" rel="stylesheet" type="text/css" media="screen"/>
{% endblock %}
{% block content %}
<body class=" ">
<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;'>
<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">
<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-12 col-sm-12 col-xs-12">
<table class="table table-hover">
<thead>
<tr>
<th style="text-align: center">图标</th>
<th style="text-align: center">新媒体名称</th>
<th style="text-align: center">新媒体ID</th>
<th style="text-align: center">责任主体</th>
<th style="text-align: center">主体类型</th>
<th style="text-align: center">行政区划</th>
<th style="text-align: center">状态</th>
<th style="text-align: center">操作</th>
</tr>
</thead>
<tbody>
{% for w in res %}
<tr>
<td><img src="{{ w.image.url }}" style="width: 60px;height: 60px;margin: auto"
class="img-circle"></td>
<td style="vertical-align: middle;text-align: center">{{ w.code }}</td>
<td style="vertical-align: middle;text-align: center">{{ w.toutiaoid }}</td>
<td style="vertical-align: middle;text-align: center">{{ w.organization }}</td>
<td style="vertical-align: middle;text-align: center">{{ w.organization_type }}</td>
<td style="vertical-align: middle;text-align: center">{{ w.administrativedivision }}</td>
<td style="vertical-align: middle;text-align: center">{{ w.status }}</td>
<td style="vertical-align: middle;text-align: center">
<a href="{% url 'newmedia-management-update-douyin' w.id %}"
class="btn btn-primary btn-mini">编辑</a>
<a href="{% url 'newmedia-management-delete-douyin' w.id %}"
class="btn btn-danger btn-mini">删除</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/douyin-management-paginate.html' %}
</div>
</div>
</div>
</div>
</section>
</div>
</section>
</section>
<div class="chatapi-windows ">
</div>
</div>
</body>
{% endblock %}
{% block add_js %}
<script src="{% static 'management/js/uikit.min.js' %}" type="text/javascript"></script>
<script src="{% static 'management/js/nestable.min.js' %}" type="text/javascript"></script>
<script>
</script>
{% endblock %}

View File

@ -83,6 +83,16 @@
<a href="{% url 'newmedia-management-edit-toutiao' %}"><span>今日头条</span></a>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-6 c">
<div class="r4_counter db_box">
<a href="{% url 'newmedia-management-edit-douyin' %}"><img
src="{% static 'dashboard/image/douyin.jpg' %}"
class='fa fa-thumbs-up '></a>
</div>
<div class="stats">
<a href="{% url 'newmedia-management-edit-douyin' %}"><span>抖音</span></a>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-6 c">
<div class="r4_counter db_box">
<a href="{% url 'newmedia-management-edit-qita' %}"><img

View File

@ -0,0 +1,113 @@
{% 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">&times;</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 'newmedia-management-update-douyin' douyin.id %}"
enctype="multipart/form-data">{% csrf_token %}
<div class="form-group">
<label class="form-label" for="code">头条号</label>
<div class="controls">
<input type="text" class="form-control" name="code"
value="{{ douyin.code }}">
</div>
</div>
<div class="form-group">
<label class="form-label" for="toutiaoid">ID</label>
<div class="controls">
<input type="text" class="form-control" name="toutiaoid"
value="{{ douyin.douyinid }}">
</div>
</div>
<div class="form-group">
<label class="form-label" for="alias">别名</label>
<div class="controls">
<input type="text" class="form-control" name="alias"
value="{{ douyin.alias }}">
</div>
</div>
<div class="form-group">
<label class="form-label" for="organization">单位</label>
<div class="controls">
<select class="form-control" name="organization">
<option value="{{ douyin.organization.id }}">{{ douyin.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="image">图标
<div class="controls">
<input type="file" name="image"><img
src="{{ douyin.image.url }}"
style="width: 80px;height: 80px;"
class="img-circle">
</div>
</label>
</div>
<div class="form-group">
<label class="form-label" for="status">状态</label>
<div class="controls">
<select class="form-control" name="status">
<option value="{{ douyin.status }}">{{ douyin.status }}</option>
{% for w in douyin_status_choices_list %}
<option value="{{ w }}">{{ w }}</option>
{% endfor %}
</select>
</div>
</div>
<button type="submit" class="btn btn-success" style="margin-top: 50px">点击新建
</button>
</form>
</div>
</div>
</div>
</section>
</div>
</section>
</section>
<div class="chatapi-windows "></div>
</div>
</body>
{% endblock %}

View File

@ -5,14 +5,21 @@
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.1/css/bootstrap.min.css">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet">
<link href="/static/django-summernote-0.8.11.4/django_summernote/static/summernote/summernote.css" rel="stylesheet">
<link href="/static/django-summernote-0.8.11.4/django_summernote/static/summernote/summernote-bs4.css" rel="stylesheet">
<link href="/static/django-summernote-0.8.11.4/django_summernote/static/summernote/summernote-lite.css" rel="stylesheet">
<link href="/static/django-summernote-0.8.11.4/django_summernote/static/summernote/django_summernote.css" rel="stylesheet">
<link href="/static/django-summernote-0.8.11.4/django_summernote/static/summernote/summernote-bs4.css"
rel="stylesheet">
<link href="/static/django-summernote-0.8.11.4/django_summernote/static/summernote/summernote-lite.css"
rel="stylesheet">
<link href="/static/django-summernote-0.8.11.4/django_summernote/static/summernote/django_summernote.css"
rel="stylesheet">
{% endblock %}
{% block content %}
<div class="container" >
<div class="page-sidebar ">
{% include 'dashboard/base/left.html' %}
</div>
<div class="container">
{% if messages %}
<div class="alert alert-danger alert-dismissible" role="alert">
@ -42,7 +49,7 @@
<label for="title">新闻分类</label>
<select class="form-control" name="type">
{% for t in type %}
<option value="{{ t.choices }}">{{ t.choices }}</option>
<option value="{{ t.choices }}">{{ t.choices }}</option>
{% endfor %}
</select>
</div>
@ -62,8 +69,8 @@
<div class="row">
<label for="country">正文</label>
<div >
<textarea id="summernote" name="content" class="input-block-level" ></textarea>
<div>
<textarea id="summernote" name="content" class="input-block-level"></textarea>
</div>
<div style="margin-top: 20px;text-align: center;padding-bottom: 20px">
@ -83,15 +90,15 @@
<script src="/static/django-summernote-0.8.11.4/django_summernote/static/summernote/jquery.ui.widget.js"></script>
<script src="/static/django-summernote-0.8.11.4/django_summernote/static/summernote/jquery.iframe-transport.js"></script>
<script>
window.onload = function () {
$('#summernote').summernote({
lang : 'zh-CN',
minHeight : 300,
dialogsFade : true,
dialogsInBody : true,
disableDragAndDrop : false,
});
};
window.onload = function () {
$('#summernote').summernote({
lang: 'zh-CN',
minHeight: 300,
dialogsFade: true,
dialogsInBody: true,
disableDragAndDrop: false,
});
};
</script>
{# <script type="text/javascript" src="/extra_apps/DjangoUeditor/static/ueditor/ueditor.config.js"></script>#}
{# <script type="text/javascript" src="/extra_apps/DjangoUeditor/static/ueditor/ueditor.all.min.js"></script>#}

View File

@ -0,0 +1,56 @@
{% extends 'dashboard/base/base.html' %}
{% load static %}
{% block title %}祁连山生态监测数据管理平台{% endblock %}
{% block css %}
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.1/css/bootstrap.min.css">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet">
<link href="/static/django-summernote-0.8.11.4/django_summernote/static/summernote/summernote.css" rel="stylesheet">
<link href="/static/django-summernote-0.8.11.4/django_summernote/static/summernote/summernote-bs4.css"
rel="stylesheet">
<link href="/static/django-summernote-0.8.11.4/django_summernote/static/summernote/summernote-lite.css"
rel="stylesheet">
<link href="/static/django-summernote-0.8.11.4/django_summernote/static/summernote/django_summernote.css"
rel="stylesheet">
{% endblock %}
{% block content %}
<div class="page-sidebar ">
{% include 'dashboard/base/left.html' %}
</div>
<div class="container">
{% if messages %}
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
{% for message in messages %}
{{ message }}.<br/>
{% endfor %}
</div>
{% endif %}
<div class="panel-heading" style="margin-top: 100px">
<h3 style="text-align: center;">{{ news.title }}</h3>
</div>
<div class="panel-body">
{# <div class="panel panel-info">#}
<div class="panel-heading">
<div class="col-md-4">新闻类型:{{ news.type }}</div>
<div class="col-md-4">作者:{{ news.author }}</div>
<div class="col-md-4">发布时间:{{ news.date }}</div>
</div>
<div class="panel-body" style="margin-top: 20px">
{{ news.content|safe }}
</div>
{# </div>#}
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,105 @@
{% extends 'dashboard/base/base.html' %}
{% load static %}
{% block css %}
<!-- OTHER SCRIPTS INCLUDED ON THIS PAGE - START -->
<link href="{% static 'management/css/uikit.min.css' %}" rel="stylesheet" type="text/css" media="screen"/>
<link href="{% static 'management/css/nestable.min.css' %}" rel="stylesheet" type="text/css" media="screen"/>
<!-- OTHER SCRIPTS INCLUDED ON THIS PAGE - END -->
{% endblock %}
{% block content %}
<body class=" "><!-- START TOPBAR -->
<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">&times;</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">
<section class="box ">
<header class="panel_header">
<h2 class="title pull-left">新闻列表</h2>
{# <div class="actions panel_actions pull-right">#}
{# <i class="box_toggle fa fa-chevron-down"></i>#}
{# <i class="box_setting fa fa-cog" data-toggle="modal" href="#section-settings"></i>#}
{# <i class="box_close fa fa-times"></i>#}
{# </div>#}
</header>
<div class="content-body">
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="row">
<div class="col-sm-12 col-md-12 col-xs-12">
<table class="table table-hover">
<thead>
<tr>
<th style="text-align: center">标题</th>
<th style="text-align: center">作者</th>
<th style="text-align: center">类型</th>
<th style="text-align: center">时间</th>
<th style="text-align: center">操作</th>
</tr>
</thead>
<tbody>
{% for n in news %}
<tr>
<td style="vertical-align: middle;text-align: left">{{ n.title }}</td>
<td style="vertical-align: middle;text-align: center">{{ n.author }}</td>
<td style="vertical-align: middle;text-align: center">{{ n.type }}</td>
<td style="vertical-align: middle;text-align: center">{{ n.date }}</td>
<td style="vertical-align: middle;text-align: center">
<a href="{% url 'news-management-detail' n.id %}"
class="btn btn-primary btn-mini">查看</a>
<a href="{% url 'news-management-delete' n.id %}"
class="btn btn-danger btn-mini">删除</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/organization-management-paginate.html' %}
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</section>
</section>
<div class="chatapi-windows ">
</div>
</div>
</body>
{% endblock %}
{% block add_js %}
<script src="{% static 'management/js/uikit.min.js' %}" type="text/javascript"></script>
<script src="{% static 'management/js/nestable.min.js' %}" type="text/javascript"></script>
<script>
</script>
{% endblock %}

View File

@ -46,7 +46,8 @@
<div class="row">
<div class="col-md-8 col-sm-9 col-xs-10">
<form method="post"
action="{% url 'organization-management-create' %}" enctype="multipart/form-data">{% csrf_token %}
action="{% url 'organization-management-create' %}"
enctype="multipart/form-data">{% csrf_token %}
<div class="form-group">
<label class="form-label" for="name">单位名</label>
<div class="controls">
@ -55,9 +56,10 @@
</div>
<div class="form-group">
<label class="form-label" for="image">图标
<div class="controls">
<input type="file" name="image">
</div></label>
<div class="controls">
<input type="file" name="image">
</div>
</label>
</div>
<div class="form-group">
<label class="form-label" for="organizationtype">单位类型</label>
@ -89,6 +91,16 @@
</select>
</div>
</div>
<div class="form-group">
<label class="form-label" for="level">权限</label>
<div class="controls">
<select class="form-control" name="level">
{% for l in level %}
<option value="{{ l.id }}">{{ l.name }}</option>
{% endfor %}
</select>
</div>
</div>
<button type="submit" class="btn btn-success" style="margin-top: 50px">点击新建
</button>
</form>

View File

@ -96,6 +96,17 @@
</select>
</div>
</div>
<div class="form-group">
<label class="form-label" for="level">权限</label>
<div class="controls">
<select class="form-control" name="level">
<option value="{{ organization.level.id }}">{{ organization.level.name }}</option>
{% for l in level %}
<option value="{{ l.id }}">{{ l.name }}</option>
{% endfor %}
</select>
</div>
</div>
<button type="submit" class="btn btn-success">提交修改</button>
</form>

View File

@ -58,8 +58,8 @@
<tr>
<th style="text-align: center">图标</th>
<th style="text-align: center">单位名称</th>
<th style="text-align: center">行政区划</th>
<th style="text-align: center">类型</th>
<th style="text-align: center">行政区划</th>
<th style="text-align: center">成员数量</th>
<th style="text-align: center">新媒体数量</th>
<th style="text-align: center">操作</th>

View File

@ -7,13 +7,15 @@ urlpatterns = [
path('user/management/', views.user_management, name='user-management-management'),
path('user/delete/<str:pk>/', views.user_delete, name='user-management-delete'),
path('user/update/<str:pk>/', views.user_update, name='user-management-update'),
# 群组管理
path('group/management/', views.group_management, name='group-management-management'),
# 矩阵管理
path('group/management/init/', views.group_management_init, name='group-management-management-init'),
path('group/management/admin/', views.group_management_admin, name='group-management-management-admin'),
path('group/management/user/', views.group_management_user, name='group-management-management-user'),
path('group/create/', views.group_create, name='group-management-create'),
path('group/update/<str:pk>/', views.group_update, name='group-management-update'),
path('group/delete/<str:pk>/', views.group_delete, name='group-management-delete'),
# 添加群组管理员、成员
# 添加矩阵管理员、成员
path('group/admin/create/<str:pk>/', views.group_admin_create, name='group-admin-create'),
path('group/admin/delete/<str:pk>/<str:group_pk>/', views.group_admin_delete, name='group-admin-delete'),
path('group/user/create/<str:pk>/', views.group_user_create, name='group-user-create'),
@ -31,18 +33,27 @@ urlpatterns = [
path('newmedia/management/create/weixin/',views.newmedia_management_create_weixin,name='newmedia-management-create-weixin'),
path('newmedia/management/create/weibo/',views.newmedia_management_create_weibo,name='newmedia-management-create-weibo'),
path('newmedia/management/create/toutiao/',views.newmedia_management_create_toutiao,name='newmedia-management-create-toutiao'),
path('newmedia/management/create/douyin/',views.newmedia_management_create_douyin,name='newmedia-management-create-douyin'),
path('newmedia/management/create/qita/',views.newmedia_management_create_qita,name='newmedia-management-create-qita'),
path('newmedia/management/edit/weixin/',views.newmedia_management_edit_weixin,name='newmedia-management-edit-weixin'),
path('newmedia/management/edit/weibo/',views.newmedia_management_edit_weibo,name='newmedia-management-edit-weibo'),
path('newmedia/management/edit/toutiao/',views.newmedia_management_edit_toutiao,name='newmedia-management-edit-toutiao'),
path('newmedia/management/edit/douyin/',views.newmedia_management_edit_douyin,name='newmedia-management-edit-douyin'),
path('newmedia/management/edit/qita/',views.newmedia_management_edit_qita,name='newmedia-management-edit-qita'),
path('newmedia/management/update/weixin/<str:pk>/',views.newmedia_management_update_weixin,name='newmedia-management-update-weixin'),
path('newmedia/management/update/weibo/<str:pk>/',views.newmedia_management_update_weibo,name='newmedia-management-update-weibo'),
path('newmedia/management/update/toutiao/<str:pk>/',views.newmedia_management_update_toutiao,name='newmedia-management-update-toutiao'),
path('newmedia/management/update/douyin/<str:pk>/',views.newmedia_management_update_douyin,name='newmedia-management-update-douyin'),
path('newmedia/management/update/qita/<str:pk>/',views.newmedia_management_update_qita,name='newmedia-management-update-qita'),
path('newmedia/management/delete/weixin/<str:pk>/',views.newmedia_management_delete_weixin,name='newmedia-management-delete-weixin'),
path('newmedia/management/delete/weibo/<str:pk>/',views.newmedia_management_delete_weibo,name='newmedia-management-delete-weibo'),
path('newmedia/management/delete/toutiao/<str:pk>/',views.newmedia_management_delete_toutiao,name='newmedia-management-delete-toutiao'),
path('newmedia/management/delete/douyin/<str:pk>/',views.newmedia_management_delete_douyin,name='newmedia-management-delete-douyin'),
path('newmedia/management/delete/qita/<str:pk>/',views.newmedia_management_delete_qita,name='newmedia-management-delete-qita'),
#新闻管理
path('news/management/',views.new_management,name='new-management'),
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/delete/<str:pk>/', views.news_management_delete, name='news-management-delete'),
]

View File

@ -8,11 +8,24 @@ from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from dashboard.models import Userprofile, Group, Organization, Level, Organizationtype, Area_code_2020, Weixin, Weibo, \
Toutiao, Qita, Group_type, Group_admin, Group_user
Toutiao, Qita, Group_type, Group_admin, Group_user, News, Douyin
def user_management(request):
userpaginator = User.objects.all().order_by('-date_joined')
user = request.user
o = Organization.objects.get(userprofile__user_id=user.id)
level = o.level.level
province = o.province
cities = o.cities
district = o.district
userpaginator = None
if level == 1:
userpaginator = User.objects.filter(userprofile__organization__province=province).order_by('-date_joined')
elif level == 2:
userpaginator = User.objects.filter(userprofile__organization__province=province,userprofile__organization__cities=cities).order_by('-date_joined')
elif level == 3:
userpaginator = User.objects.filter(userprofile__organization__province=province,
userprofile__organization__cities=cities,userprofile__organization__district=district).order_by('-date_joined')
paginator = Paginator(userpaginator, 6)
page = int(request.GET.get('page', 1))
try:
@ -73,10 +86,10 @@ def user_update(request, pk):
userprofile.image = image
user.save()
userprofile.save()
messages.success(request,"修改成功")
messages.success(request, "修改成功")
return HttpResponseRedirect("/")
else:
messages.error(request,'两次输入密码不一致')
messages.error(request, '两次输入密码不一致')
return HttpResponseRedirect('/management/user/update/%s/' % (pk))
else:
user.email = email
@ -94,9 +107,12 @@ def user_update(request, pk):
{'usee': user, 'userprofile': userprofile, 'organization': organization})
def group_management(request):
group = Group.objects.all().order_by('-created')
paginator = Paginator(group, 6)
def group_management_init(request):
user = request.user
# 创建的矩阵
group_initer = Group.objects.filter(user_id=user.id)
print(group_initer)
paginator = Paginator(group_initer, 6)
page = int(request.GET.get('page', 1))
try:
group = paginator.page(page)
@ -104,18 +120,76 @@ def group_management(request):
group = paginator.page(1)
except EmptyPage:
group = paginator.page(paginator.num_pages)
res = []
for g in group:
o = dict()
o['id'] = str(g.id)
o['image'] = g.image.url
o['name'] = g.name
o['type'] = g.type
o['admin_count'] = Group_admin.objects.filter(group_id=g.id).count()
o['user_count'] = Group_user.objects.filter(group_id=g.id).count()
o['status'] = g.status
res.append(o)
return render(request, 'management/group-management.html', {'res': res, 'group': group})
res_g_i = []
for r_g_i in group:
o1 = dict()
o1['id'] = str(r_g_i.id)
o1['image'] = r_g_i.image.url
o1['name'] = r_g_i.name
o1['type'] = r_g_i.type
o1['admin_count'] = Group_admin.objects.filter(group_id=r_g_i.id).count()
o1['user_count'] = Group_user.objects.filter(group_id=r_g_i.id).count()
o1['status'] = r_g_i.status
res_g_i.append(o1)
return render(request, 'management/group-management-init.html', {'group': group, 'res_g_i': res_g_i})
def group_management_admin(request):
# 管理的矩阵
user = request.user
group_admin_list = []
for g_a in Group_admin.objects.filter(user_id=user.id):
group_admin = Group.objects.get(id=g_a.group_id)
group_admin_list.append(group_admin)
paginator = Paginator(group_admin_list, 6)
page = int(request.GET.get('page', 1))
try:
group = paginator.page(page)
except PageNotAnInteger:
group = paginator.page(1)
except EmptyPage:
group = paginator.page(paginator.num_pages)
res_g_a = []
for r_g_a in group:
o2 = dict()
o2['id'] = str(r_g_a.id)
o2['image'] = r_g_a.image.url
o2['name'] = r_g_a.name
o2['type'] = r_g_a.type
o2['admin_count'] = Group_admin.objects.filter(group_id=r_g_a.id).count()
o2['user_count'] = Group_user.objects.filter(group_id=r_g_a.id).count()
o2['status'] = r_g_a.status
res_g_a.append(o2)
return render(request, 'management/group-management-admin.html', {'group': group, 'res_g_a': res_g_a})
def group_management_user(request):
# 加入的矩阵
user = request.user
group_user_list = []
for g_u in Group_user.objects.filter(user_id=user.id):
group_user = Group.objects.get(id=g_u.group_id)
group_user_list.append(group_user)
paginator = Paginator(group_user_list, 6)
page = int(request.GET.get('page', 1))
try:
group = paginator.page(page)
except PageNotAnInteger:
group = paginator.page(1)
except EmptyPage:
group = paginator.page(paginator.num_pages)
res_g_u = []
for r_g_u in group:
o3 = dict()
o3['id'] = str(r_g_u.id)
o3['image'] = r_g_u.image.url
o3['name'] = r_g_u.name
o3['type'] = r_g_u.type
o3['admin_count'] = Group_admin.objects.filter(group_id=r_g_u.id).count()
o3['user_count'] = Group_user.objects.filter(group_id=r_g_u.id).count()
o3['status'] = r_g_u.status
res_g_u.append(o3)
return render(request, 'management/group-management-user.html', {'group': group, 'res_g_u': res_g_u})
def group_update(request, pk):
@ -190,19 +264,20 @@ def group_update(request, pk):
g.image = image
g.save()
messages.success(request, '修改成功')
return HttpResponseRedirect('/management/group/management/')
return HttpResponseRedirect('/management/group/management/init/')
else:
Group.objects.filter(id=pk).update(name=name, presentation=presentation, type_id=type, status=status,
province=province_r, cities=city_r, district=district_r, town=town_r,
village=village_r)
messages.success(request, '修改成功')
return HttpResponseRedirect('/management/group/management/')
return HttpResponseRedirect('/management/group/management/init/')
return render(request, 'management/group-management-update.html',
{'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})
def group_create(request):
user = request.user
GROUP_STATUS_CHOICES = Group.GROUP_STATUS_CHOICES
group_status_choices_list = []
for g in GROUP_STATUS_CHOICES:
@ -243,12 +318,13 @@ def group_create(request):
print(name, presentation, image, type, status, province, city, district, town, village)
if name is not None:
group = Group(name=name, presentation=presentation, image=image, type_id=type, status=status,
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)
group.save()
messages.success(request, '添加成功')
return render(request,'management/add-group-admin-and-user.html',{'group':group})
else:
messages.error(request, '群组名不能为空')
return HttpResponseRedirect('/management/group/management/')
messages.error(request, '矩阵名不能为空')
# return HttpResponseRedirect('/management/group/management/')
return render(request, 'management/group-management-create.html',
{'group_status_choices_list': group_status_choices_list, 'group_type': group_type})
@ -308,15 +384,31 @@ def group_delete(request, pk):
def organization_management(request):
organization = Organization.objects.all().order_by('-created')
paginator = Paginator(organization, 6)
page = int(request.GET.get('page', 1))
try:
organization = paginator.page(page)
except PageNotAnInteger:
organization = paginator.page(1)
except EmptyPage:
organization = paginator.page(paginator.num_pages)
user = request.user
o = Organization.objects.get(userprofile__user_id=user.id)
print(o)
level = o.level.level
province = o.province
cities = o.cities
district = o.district
print(level, province, cities, district)
organization = None
if level == 1:
organization = Organization.objects.filter(province=province).order_by('-created')
elif level == 2:
organization = Organization.objects.filter(province=province, cities=cities).order_by('-created')
elif level == 3:
organization = Organization.objects.filter(province=province, cities=cities, district=district).order_by(
'-created')
if organization is not None:
paginator = Paginator(organization, 6)
page = int(request.GET.get('page', 1))
try:
organization = paginator.page(page)
except PageNotAnInteger:
organization = paginator.page(1)
except EmptyPage:
organization = paginator.page(paginator.num_pages)
res = []
for i in organization:
o = dict()
@ -324,8 +416,26 @@ def organization_management(request):
o['name'] = i.name
o['image'] = i.image.url
o['organizationtype'] = i.organizationtype.organizationtype
o['administrativedivision'] = str(i.province) + '-' + str(i.cities) + '-' + str(i.district) + '-' + str(
i.town) + '-' + str(i.village)
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(
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.town).name) + '-' + str(
Area_code_2020.objects.get(code=i.village).name)
elif len(i.province) > 0 and len(i.cities) > 0 and len(i.district) > 0 and len(i.town) > 0:
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.district).name) + '-' + str(
Area_code_2020.objects.get(code=i.town).name)
elif len(i.province) > 0 and len(i.cities) > 0 and len(i.district) > 0:
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.district).name)
elif len(i.province) > 0 and len(i.cities) > 0 :
o['administrativedivision'] = str(Area_code_2020.objects.get(code=i.province).name) + '-' + str(
Area_code_2020.objects.get(code=i.cities).name)
elif len(i.province) > 0:
o['administrativedivision'] = str(Area_code_2020.objects.get(code=i.province).name)
o['usercount'] = Userprofile.objects.filter(organization_id=i.id).count()
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(
@ -345,40 +455,42 @@ def organization_delete(request, pk):
def organization_update(request, pk):
organization = Organization.objects.get(id=pk)
organizationtype = Organizationtype.objects.all()
level = Level.objects.all()
if request.method == 'POST':
name = request.POST.get('name')
image = request.FILES.get('image')
organizationtype = request.POST.get('organizationtype')
province = request.POST.get('province')
level_id = request.POST.get('level')
if province != '' and province.isdigit():
province_r = Area_code_2020.objects.get(code=province).name
else:
province_r = province
else:
province_r = Area_code_2020.objects.get(name=province).code
city = request.POST.get('city')
if city != '' and city.isdigit():
city_r = Area_code_2020.objects.get(code=city).name
else:
city_r = city
else:
city_r = Area_code_2020.objects.get(name=city).code
district = request.POST.get('district')
if district != '' and district.isdigit():
district_r = Area_code_2020.objects.get(code=district).name
else:
district_r = district
else:
district_r = Area_code_2020.objects.get(name=district).code
town = request.POST.get('town')
if town != '' and town.isdigit():
town_r = Area_code_2020.objects.get(code=town).name
else:
town_r = town
else:
town_r = Area_code_2020.objects.get(name=town).code
village = request.POST.get('village')
if village != '' and village.isdigit():
village_r = Area_code_2020.objects.get(code=village).name
else:
village_r = village
else:
village_r = Area_code_2020.objects.get(name=village).code
if name is not None:
if image is not None:
Organization.objects.filter(id=pk).update(name=name, organizationtype_id=organizationtype,
province=province_r, cities=city_r, district=district_r,
town=town_r, village=village_r)
town=town_r, village=village_r,level_id=level_id)
o = Organization.objects.get(id=pk)
o.image = image
o.save()
@ -387,56 +499,41 @@ def organization_update(request, pk):
else:
Organization.objects.filter(id=pk).update(name=name, organizationtype_id=organizationtype,
province=province_r, cities=city_r, district=district_r,
town=town_r, village=village_r)
town=town_r, village=village_r,level_id=level_id)
messages.success(request, '修改成功')
return HttpResponseRedirect('/management/organization/management/')
return render(request, 'management/organization-management-update.html',
{'organization': organization, 'organizationtype': organizationtype})
{'organization': organization, 'organizationtype': organizationtype,'level':level})
def organization_create(request):
organizationtype = Organizationtype.objects.all()
level = Level.objects.all()
if request.method == 'POST':
name = request.POST.get('name')
image = request.FILES.get('image')
organizationtype = request.POST.get('organizationtype')
level_id = request.POST.get('level_id')
province = request.POST.get('province')
if province != '':
province_r = Area_code_2020.objects.get(code=province).name
province = province
else:
messages.error(request, '请选择行政区划')
return HttpResponseRedirect('/management/organization/create/')
city = request.POST.get('city')
if city != '':
city_r = Area_code_2020.objects.get(code=city).name
else:
city_r = city
district = request.POST.get('district')
if district != '':
district_r = Area_code_2020.objects.get(code=district).name
else:
district_r = district
town = request.POST.get('town')
if town != '':
town_r = Area_code_2020.objects.get(code=town).name
else:
town_r = town
village = request.POST.get('village')
if village != '':
village_r = Area_code_2020.objects.get(code=village).name
else:
village_r = village
print(province, city)
if name is not None:
organization = Organization(name=name, image=image, organizationtype_id=organizationtype,
province=province_r, cities=city_r, district=district_r, town=town_r,
village=village_r)
province=province, cities=city, district=district, town=town,
village=village,level_id=level_id)
organization.save()
messages.success(request, '添加成功')
else:
messages.error(request, '单位名不能为空')
return HttpResponseRedirect('/management/organization/management/')
return render(request, 'management/organization-management-create.html', {'organizationtype': organizationtype})
return render(request, 'management/organization-management-create.html', {'organizationtype': organizationtype,'level':level})
def newmedia_management_create_menu(request):
@ -448,7 +545,7 @@ def newmedia_management_create_weixin(request):
weixin_status_choices_list = []
for w in WEIXIN_STATUS_CHOICES:
weixin_status_choices_list.append(list(w)[1])
organization = Organization.objects.all()
organization = Organization.objects.all().order_by('-name')
if request.method == 'POST':
code = request.POST.get('code')
weixinid = request.POST.get('weixinid')
@ -487,7 +584,7 @@ def newmedia_management_create_weibo(request):
weibo_status_choices_list = []
for w in WEIBO_STATUS_CHOICES:
weibo_status_choices_list.append(list(w)[1])
organization = Organization.objects.all()
organization = Organization.objects.all().order_by('-name')
if request.method == 'POST':
code = request.POST.get('code')
weiboid = request.POST.get('weiboid')
@ -527,7 +624,7 @@ def newmedia_management_create_toutiao(request):
toutiao_status_choices_list = []
for w in TOUTIAO_STATUS_CHOICES:
toutiao_status_choices_list.append(list(w)[1])
organization = Organization.objects.all()
organization = Organization.objects.all().order_by('-name')
if request.method == 'POST':
code = request.POST.get('code')
toutiaoid = request.POST.get('toutiaoid')
@ -561,13 +658,52 @@ def newmedia_management_create_toutiao(request):
return render(request, 'management/newmedia-management-create-toutiao.html',
{'toutiao_status_choices_list': toutiao_status_choices_list, "organization": organization})
def newmedia_management_create_douyin(request):
DOUYIN_STATUS_CHOICES = Douyin.NEWMEDIA_STATUS_CHOICES
douyin_status_choices_list = []
for w in DOUYIN_STATUS_CHOICES:
douyin_status_choices_list.append(list(w)[1])
print(douyin_status_choices_list)
organization = Organization.objects.all().order_by('-name')
if request.method == 'POST':
code = request.POST.get('code')
douyinid = request.POST.get('douyinid')
alias = request.POST.get('alias')
image = request.FILES.get('image')
organization = request.POST.get('organization')
status = request.POST.get('status')
if code is not None:
if organization is not None:
if image is not None:
douyin = Douyin(code=code, douyinid=douyinid, alias=alias, image=image,
organization_id=organization, status=status)
douyin.save()
messages.success(request, '创建成功')
return HttpResponseRedirect('/management/newmedia/management/create/douyin/')
else:
douyin = Douyin(code=code, douyinid=douyinid, alias=alias, image='douyin.png',
organization_id=organization, status=status)
douyin.save()
messages.success(request, '创建成功')
return HttpResponseRedirect('/management/newmedia/management/create/douyin/')
else:
messages.success(request, "请选择单位")
return render(request, 'management/newmedia-management-create-douyin.html',
{'douyin_status_choices_list': douyin_status_choices_list,
"organization": organization})
else:
messages.success(request, "抖音号不能为空")
return render(request, 'management/newmedia-management-create-douyin.html',
{'douyin_status_choices_list': douyin_status_choices_list, "organization": organization})
return render(request, 'management/newmedia-management-create-douyin.html',
{'douyin_status_choices_list': douyin_status_choices_list, "organization": organization})
def newmedia_management_create_qita(request):
QITA_STATUS_CHOICES = Qita.NEWMEDIA_STATUS_CHOICES
qita_status_choices_list = []
for w in QITA_STATUS_CHOICES:
qita_status_choices_list.append(list(w)[1])
organization = Organization.objects.all()
organization = Organization.objects.all().order_by('-name')
if request.method == 'POST':
type = request.POST.get('type')
name = request.POST.get('name')
@ -607,7 +743,20 @@ def newmedia_management_edit_menu(request):
def newmedia_management_edit_weixin(request):
weixin = Weixin.objects.all().order_by('-created')
user = request.user
o = Organization.objects.get(userprofile__user_id=user.id)
level = o.level.level
province = o.province
cities = o.cities
district = o.district
weixin = None
if level == 1:
weixin = Weixin.objects.filter(organization__province=province).order_by('-created')
elif level == 2:
weixin = Weixin.objects.filter(organization__province=province,organization__cities=cities).order_by('-created')
elif level == 3:
weixin = Weixin.objects.filter(organization__province=province, organization__cities=cities,organization__district=district).order_by(
'-created')
paginator = Paginator(weixin, 6)
page = int(request.GET.get('page', 1))
try:
@ -633,7 +782,19 @@ def newmedia_management_edit_weixin(request):
def newmedia_management_edit_weibo(request):
weibo = Weibo.objects.all().order_by('-created')
user = request.user
o = Organization.objects.get(userprofile__user_id=user.id)
level = o.level.level
province = o.province
cities = o.cities
district = o.district
weibo = None
if level == 1:
weibo = Weibo.objects.filter(organization__province=province).order_by('-created')
elif level == 2:
weibo = Weibo.objects.filter(organization__province=province,organization__cities=cities).order_by('-created')
elif level == 3:
weibo = Weibo.objects.filter(organization__province=province, organization__cities=cities,organization__district=district).order_by('-created')
paginator = Paginator(weibo, 6)
page = int(request.GET.get('page', 1))
try:
@ -659,7 +820,20 @@ def newmedia_management_edit_weibo(request):
def newmedia_management_edit_toutiao(request):
toutiao = Toutiao.objects.all().order_by('-created')
user = request.user
o = Organization.objects.get(userprofile__user_id=user.id)
level = o.level.level
province = o.province
cities = o.cities
district = o.district
toutiao = None
if level == 1:
toutiao = Toutiao.objects.filter(organization__province=province).order_by('-created')
elif level == 2:
toutiao = Toutiao.objects.filter(organization__province=province,organization__cities=cities).order_by('-created')
elif level == 3:
toutiao = Toutiao.objects.filter(organization__province=province, organization__cities=cities,organization__district=district).order_by(
'-created')
paginator = Paginator(toutiao, 6)
page = int(request.GET.get('page', 1))
try:
@ -683,9 +857,57 @@ def newmedia_management_edit_toutiao(request):
res.append(o)
return render(request, 'management/newmedia-management-edit-toutiao.html', {'toutiao': toutiao, 'res': res})
def newmedia_management_edit_douyin(request):
user = request.user
o = Organization.objects.get(userprofile__user_id=user.id)
level = o.level.level
province = o.province
cities = o.cities
district = o.district
douyin = None
if level == 1:
douyin = Douyin.objects.filter(organization__province=province).order_by('-created')
elif level == 2:
douyin = Douyin.objects.filter(organization__province=province,organization__cities=cities).order_by('-created')
elif level == 3:
douyin = Douyin.objects.filter(organization__province=province, organization__cities=cities,organization__district=district).order_by(
'-created')
paginator = Paginator(douyin, 6)
page = int(request.GET.get('page', 1))
try:
douyin = paginator.page(page)
except PageNotAnInteger:
douyin = paginator.page(1)
except EmptyPage:
douyin = paginator.page(paginator.num_pages)
res = []
for w in douyin:
o = dict()
o['id'] = str(w.id)
o['image'] = w.image
o['code'] = w.code
o['douyinid'] = w.douyinid
o['organization'] = w.organization.name
o['organization_type'] = w.organization.organizationtype.organizationtype
o['administrativedivision'] = str(w.organization.province) + '-' + str(w.organization.cities) + '-' + str(
w.organization.district) + '-' + str(w.organization.town) + '-' + str(w.organization.village)
o['status'] = w.status
res.append(o)
return render(request, 'management/newmedia-management-edit-douyin.html', {'douyin': douyin, 'res': res})
def newmedia_management_edit_qita(request):
qita = Qita.objects.all().order_by('-created')
user = request.user
o = Organization.objects.get(userprofile__user_id=user.id)
level = o.level.level
province = o.province
cities = o.cities
district = o.district
qita = None
if level == 1:
qita = Qita.objects.filter(organization__province=province).order_by('-created')
elif level == 2:
qita = Qita.objects.filter(organization__province=province,organization__cities=cities).order_by('-created')
elif level == 3:
qita = Qita.objects.filter(organization__province=province, organization__cities=cities,organization__district=district).order_by('-created')
paginator = Paginator(qita, 6)
page = int(request.GET.get('page', 1))
try:
@ -712,7 +934,7 @@ def newmedia_management_edit_qita(request):
def newmedia_management_update_weixin(request, pk):
WEIXIN_STATUS_CHOICES = Weixin.WEIXIN_STATUS_CHOICES
WEIXIN_STATUS_CHOICES = Weixin.NEWMEDIA_STATUS_CHOICES
weixin_status_choices_list = []
for w in WEIXIN_STATUS_CHOICES:
weixin_status_choices_list.append(list(w)[1])
@ -755,7 +977,7 @@ def newmedia_management_update_weixin(request, pk):
def newmedia_management_update_weibo(request, pk):
WEIBO_STATUS_CHOICES = Weibo.WEIBO_STATUS_CHOICES
WEIBO_STATUS_CHOICES = Weibo.NEWMEDIA_STATUS_CHOICES
weibo_status_choices_list = []
for w in WEIBO_STATUS_CHOICES:
weibo_status_choices_list.append(list(w)[1])
@ -798,7 +1020,7 @@ def newmedia_management_update_weibo(request, pk):
def newmedia_management_update_toutiao(request, pk):
TOUTIAO_STATUS_CHOICES = Toutiao.TOUTIAO_STATUS_CHOICES
TOUTIAO_STATUS_CHOICES = Toutiao.NEWMEDIA_STATUS_CHOICES
toutiao_status_choices_list = []
for w in TOUTIAO_STATUS_CHOICES:
toutiao_status_choices_list.append(list(w)[1])
@ -839,9 +1061,49 @@ def newmedia_management_update_toutiao(request, pk):
{'toutiao': toutiao, 'organization': organization,
'toutiao_status_choices_list': toutiao_status_choices_list})
def newmedia_management_update_douyin(request, pk):
DOUYIN_STATUS_CHOICES = Douyin.NEWMEDIA_STATUS_CHOICES
douyin_status_choices_list = []
for w in DOUYIN_STATUS_CHOICES:
douyin_status_choices_list.append(list(w)[1])
douyin = Douyin.objects.get(id=pk)
organization = Organization.objects.all()
if request.method == 'POST':
code = request.POST.get('code')
douyinid = request.POST.get('douyinid')
alias = request.POST.get('alias')
image = request.FILES.get('image')
organization = request.POST.get('organization')
status = request.POST.get('status')
if code is not None:
if organization is not None:
if image is not None:
Douyin.objects.filter(id=pk).update(code=code, douyinid=douyinid, alias=alias,
organization_id=organization, status=status)
douyin.image = image
douyin.save()
messages.success(request, '修改成功')
return HttpResponseRedirect('/management/newmedia/management/edit/douyin/')
else:
Douyin.objects.filter(id=pk).update(code=code, douyinid=douyinid, alias=alias,
organization_id=organization, status=status)
messages.success(request, '修改成功')
return HttpResponseRedirect('/management/newmedia/management/edit/douyin/')
else:
messages.success(request, "请选择单位")
return render(request, 'management/newmedia-management-update-douyin.html',
{'douyin': douyin, 'organization': organization,
'douyin_status_choices_list': douyin_status_choices_list})
else:
messages.success(request, "抖音号不能为空")
return render(request, 'management/newmedia-management-update-douyin.html',
{'douyin': douyin, 'organization': organization,
'douyin_status_choices_list': douyin_status_choices_list})
return render(request, 'management/newmedia-management-update-douyin.html',
{'douyin': douyin, 'organization': organization,
'douyin_status_choices_list': douyin_status_choices_list})
def newmedia_management_update_qita(request, pk):
QITA_STATUS_CHOICES = Qita.QITA_STATUS_CHOICES
QITA_STATUS_CHOICES = Qita.NEWMEDIA_STATUS_CHOICES
qita_status_choices_list = []
for w in QITA_STATUS_CHOICES:
qita_status_choices_list.append(list(w)[1])
@ -904,9 +1166,63 @@ def newmedia_management_delete_toutiao(request, pk):
messages.success(request, "删除成功")
return HttpResponseRedirect('/management/newmedia/management/edit/toutiao/')
def newmedia_management_delete_douyin(request, pk):
douyin = Douyin.objects.get(id=pk)
douyin.delete()
messages.success(request, "删除成功")
return HttpResponseRedirect('/management/newmedia/management/edit/douyin/')
def newmedia_management_delete_qita(request, pk):
qita = Qita.objects.get(id=pk)
qita.delete()
messages.success(request, "删除成功")
return HttpResponseRedirect('/management/newmedia/management/edit/qita/')
def new_management(request):
news = News.objects.all()
news_list = []
for n in news:
o = dict()
o['id'] = str(n.id)
o['title'] = n.title
o['date'] = n.date
o['author'] = n.author
if n.type == '0':
o['type'] = '政策依据'
elif n.type == '1':
o['type'] = '基层动态'
elif n.type == '2':
o['type'] = '外省动态'
elif n.type == '3':
o['type'] = '监测通报'
elif n.type == '4':
o['type'] = '舆情热点'
news_list.append(o)
return render(request,'management/news-management.html',{'news':news_list})
def news_management_create(request):
if request.method == 'POST':
type = request.POST.get('type')
title = request.POST.get('title')
author = request.POST.get('author')
date = request.POST.get('date')
content = request.POST.get('content')
print(str(title), str(content))
news = News(type=type, title=title, author=author, date=date, content=content)
news.save()
messages.success(request, '添加成功!!!')
return HttpResponseRedirect('/add/news/')
type = News.NEWMEDIA_NEWS_CHOICES
results = []
for i in type:
o = dict()
o['choices'] = list(i)[1]
results.append(o)
return render(request, 'management/news-management-create.html', {'type': results})
def news_management_detail(request,pk):
news = News.objects.get(id=pk)
return render(request,'management/news-management-detail.html',{'news':news})
def news_management_delete(request,pk):
news = News.objects.get(id=pk)
news.delete()
messages.success(request,'删除成功')
return HttpResponseRedirect('/management/news/management/')

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -355,7 +355,7 @@ if (typeof jQuery === 'undefined') {
Carousel.prototype.getItemIndex = function (item) {
this.$items = item.parent().children('.item')
return this.$items.index(item || this.$active)
return this.$items.data(item || this.$active)
}
Carousel.prototype.getItemForDirection = function (direction, active) {

File diff suppressed because one or more lines are too long

4
static/js/d3.v3.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1984,14 +1984,14 @@ jvm.Region.prototype.updateLabelPosition = function(){
this.isImage = !!this.config.style.initial.image;
this.createShape();
text = this.getLabelText(config.index);
text = this.getLabelText(config.data);
if (this.config.label && text) {
this.offsets = this.getLabelOffsets(config.index);
this.offsets = this.getLabelOffsets(config.data);
this.labelX = config.cx / this.map.scale - this.map.transX;
this.labelY = config.cy / this.map.scale - this.map.transY;
this.label = config.canvas.addText({
text: text,
'data-index': config.index,
'data-index': config.data,
dy: "0.6ex",
x: this.labelX,
y: this.labelY
@ -2010,7 +2010,7 @@ jvm.Marker.prototype.createShape = function(){
this.shape.remove();
}
this.shape = this.config.canvas[this.isImage ? 'addImage' : 'addCircle']({
"data-index": this.config.index,
"data-index": this.config.data,
cx: this.config.cx,
cy: this.config.cy
}, this.config.style, this.config.group);

View File

@ -5959,7 +5959,7 @@ var accordion = $.widget( "ui.accordion", {
var keyCode = $.ui.keyCode,
length = this.headers.length,
currentIndex = this.headers.index( event.target ),
currentIndex = this.headers.data( event.target ),
toFocus = false;
switch ( event.keyCode ) {
@ -6021,7 +6021,7 @@ var accordion = $.widget( "ui.accordion", {
// was active, active panel still exists
} else {
// make sure active index is correct
options.active = this.headers.index( this.active );
options.active = this.headers.data( this.active );
}
this._destroyIcons();
@ -6202,7 +6202,7 @@ var accordion = $.widget( "ui.accordion", {
return;
}
options.active = collapsing ? false : this.headers.index( clicked );
options.active = collapsing ? false : this.headers.data( clicked );
// when the call to ._toggle() comes after the class changes
// it causes a very odd bug in IE 8 (see #6720)
@ -6285,7 +6285,7 @@ var accordion = $.widget( "ui.accordion", {
that = this,
adjust = 0,
down = toShow.length &&
( !toHide.length || ( toShow.index() < toHide.index() ) ),
( !toHide.length || ( toShow.data() < toHide.data() ) ),
animate = this.options.animate || {},
options = down && animate.down || animate,
complete = function() {
@ -6578,7 +6578,7 @@ var menu = $.widget( "ui.menu", {
}
match = this._filterMenuItems( character );
match = skip && match.index( this.active.next() ) !== -1 ?
match = skip && match.data( this.active.next() ) !== -1 ?
this.active.nextAll( ".ui-menu-item" ) :
match;
@ -10147,7 +10147,7 @@ var dialog = $.widget( "ui.dialog", {
};
this.originalPosition = {
parent: this.element.parent(),
index: this.element.parent().children().index( this.element )
index: this.element.parent().children().data( this.element )
};
this.originalTitle = this.element.attr( "title" );
this.options.title = this.options.title || this.originalTitle;
@ -11203,16 +11203,16 @@ var selectmenu = $.widget( "ui.selectmenu", {
var item = ui.item.data( "ui-selectmenu-item" );
// Prevent inital focus from firing and check if its a newly focused item
if ( that.focusIndex != null && item.index !== that.focusIndex ) {
if ( that.focusIndex != null && item.data !== that.focusIndex ) {
that._trigger( "focus", event, { item: item } );
if ( !that.isOpen ) {
that._select( item, event );
}
}
that.focusIndex = item.index;
that.focusIndex = item.data;
that.button.attr( "aria-activedescendant",
that.menuItems.eq( item.index ).attr( "id" ) );
that.menuItems.eq( item.data ).attr( "id" ) );
}
})
.menu( "instance" );
@ -11524,12 +11524,12 @@ var selectmenu = $.widget( "ui.selectmenu", {
var oldIndex = this.element[ 0 ].selectedIndex;
// Change native select element
this.element[ 0 ].selectedIndex = item.index;
this.element[ 0 ].selectedIndex = item.data;
this._setText( this.buttonText, item.label );
this._setAria( item );
this._trigger( "select", event, { item: item } );
if ( item.index !== oldIndex ) {
if ( item.data !== oldIndex ) {
this._trigger( "change", event, { item: item } );
}
@ -11537,7 +11537,7 @@ var selectmenu = $.widget( "ui.selectmenu", {
},
_setAria: function( item ) {
var id = this.menuItems.eq( item.index ).attr( "id" );
var id = this.menuItems.eq( item.data ).attr( "id" );
this.button.attr({
"aria-labelledby": id,
@ -12917,7 +12917,7 @@ var tabs = $.widget( "ui.tabs", {
if ( $.isArray( options.disabled ) ) {
options.disabled = $.unique( options.disabled.concat(
$.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
return that.tabs.index( li );
return that.tabs.data( li );
})
) ).sort();
}
@ -12954,7 +12954,7 @@ var tabs = $.widget( "ui.tabs", {
// check for a tab marked active via a class
if ( active === null ) {
active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
active = this.tabs.data( this.tabs.filter( ".ui-tabs-active" ) );
}
// no active tab, set to false
@ -12965,7 +12965,7 @@ var tabs = $.widget( "ui.tabs", {
// handle numbers: negative, out of range
if ( active !== false ) {
active = this.tabs.index( this.tabs.eq( active ) );
active = this.tabs.data( this.tabs.eq( active ) );
if ( active === -1 ) {
active = collapsible ? false : 0;
}
@ -12988,7 +12988,7 @@ var tabs = $.widget( "ui.tabs", {
_tabKeydown: function( event ) {
var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
selectedIndex = this.tabs.index( focusedTab ),
selectedIndex = this.tabs.data( focusedTab ),
goingForward = true;
if ( this._handlePageNav( event ) ) {
@ -13140,7 +13140,7 @@ var tabs = $.widget( "ui.tabs", {
// get disabled tabs from class attribute from HTML
// this will get converted to a boolean if needed in _refresh()
options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
return lis.index( tab );
return lis.data( tab );
});
this._processTabs();
@ -13162,7 +13162,7 @@ var tabs = $.widget( "ui.tabs", {
// was active, active tab still exists
} else {
// make sure active index is correct
options.active = this.tabs.index( this.active );
options.active = this.tabs.data( this.active );
}
this._refresh();
@ -13425,7 +13425,7 @@ var tabs = $.widget( "ui.tabs", {
return;
}
options.active = collapsing ? false : this.tabs.index( tab );
options.active = collapsing ? false : this.tabs.data( tab );
this.active = clickedIsActive ? $() : tab;
if ( this.xhr ) {
@ -13437,7 +13437,7 @@ var tabs = $.widget( "ui.tabs", {
}
if ( toShow.length ) {
this.load( this.tabs.index( tab ), event );
this.load( this.tabs.data( tab ), event );
}
this._toggle( event, eventData );
},
@ -13532,7 +13532,7 @@ var tabs = $.widget( "ui.tabs", {
_getIndex: function( index ) {
// meta-function to give users option to provide a href string instead of a numerical index.
if ( typeof index === "string" ) {
index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) );
index = this.anchors.data( this.anchors.filter( "[href$='" + index + "']" ) );
}
return index;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

BIN
static/media/douyin.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB