diff --git a/backstage/templates/backstage/backstage-comment.html b/backstage/templates/backstage/backstage-comment.html new file mode 100644 index 0000000..81dc779 --- /dev/null +++ b/backstage/templates/backstage/backstage-comment.html @@ -0,0 +1,60 @@ +{% extends 'dashboard/base/base.html' %} +{% load static %} +{% block content %} + + + + +
+ +
+ {% include 'dashboard/base/left.html' %} +
+
+
+ {% if messages %} + + {% endif %} + +
+
+
+
+
+
评论数据录入
+
+ +
{% csrf_token %} +{#
#} +{# #} +{# #} +{#
#} +
+ + +

请上传csv文件(文件表头依次为:评论、回复、新媒体名称、标题、时间、文章链接。时间格式为(2020/11/17))

+
+ +
+
+ +
+
+ +
+ +
+
+ +{% endblock %} + diff --git a/backstage/templates/backstage/backstage-error.html b/backstage/templates/backstage/backstage-error.html new file mode 100644 index 0000000..e7951b6 --- /dev/null +++ b/backstage/templates/backstage/backstage-error.html @@ -0,0 +1,60 @@ +{% extends 'dashboard/base/base.html' %} +{% load static %} +{% block content %} + + + + +
+ +
+ {% include 'dashboard/base/left.html' %} +
+
+
+ {% if messages %} + + {% endif %} + +
+
+
+
+
+
错别字数据录入
+
+ +
{% csrf_token %} +{#
#} +{# #} +{# #} +{#
#} +
+ + +

请上传csv文件(文件表头依次为:错误、建议、定位、新媒体类型、账号、发文时间、标题、市、监测时间。时间格式为(2020/11/17))

+
+ +
+
+ +
+
+ +
+ +
+
+ +{% endblock %} + diff --git a/backstage/urls.py b/backstage/urls.py index 330a401..008db21 100644 --- a/backstage/urls.py +++ b/backstage/urls.py @@ -6,4 +6,5 @@ from backstage import views urlpatterns = [ path('backstage/newmedia/public/opinion/',views.backstage_new_media_public_opinion,name='backstage-new-media-public-opinion'), path('backstage/error/',views.backstage_error,name='backstage-error'), + path('backstage/comment/',views.backstage_comment,name='backstage-comment'), ] diff --git a/backstage/views.py b/backstage/views.py index 054f3cd..3f925a4 100644 --- a/backstage/views.py +++ b/backstage/views.py @@ -9,7 +9,7 @@ from django.shortcuts import render # Create your views here. from NewMediaMonitoring import settings -from dashboard.models import TimelinessMonitoring +from dashboard.models import TimelinessMonitoring, Wrongly, Comment def backstage_new_media_public_opinion(request): @@ -20,7 +20,7 @@ def backstage_new_media_public_opinion(request): if not os.path.exists(settings.MEDIA_ROOT): os.makedirs(settings.MEDIA_ROOT) if filename is None: - messages.error(request,'请选择要上传的文件!!!') + messages.error(request, '请选择要上传的文件!!!') return HttpResponseRedirect('/backstage/backstage/newmedia/public/opinion/') if str(filename).split('.')[1] == 'csv': data = filename.read().decode("utf-8") @@ -40,7 +40,6 @@ def backstage_new_media_public_opinion(request): # messages.error(request, '请上传正确的时间格式!!!') # return HttpResponseRedirect('/backstage/backstage/newmedia/public/opinion/') - try: if v[8] != '更新次数': # if v[8].isdigit(): @@ -76,5 +75,74 @@ def backstage_new_media_public_opinion(request): return render(request, 'backstage/backstage_new_media_public_opinion.html') -def backstage_error(resquest): - pass \ No newline at end of file + +def backstage_error(request): + if request.method == 'POST': + filename = request.FILES.get('file') + if not os.path.exists(settings.MEDIA_ROOT): + os.makedirs(settings.MEDIA_ROOT) + if filename is None: + messages.error(request, '请选择要上传的文件!!!') + return HttpResponseRedirect('/backstage/backstage/error/') + if str(filename).split('.')[1] == 'csv': + data = filename.read().decode("utf-8") + line = str(data).split('\n') + for l in line: + v = l.split(',') + try: + if v[0] != '错误': + print(v[0]) + error = v[0] + idea = v[1] + site = v[2] + n_type = v[3] + n_name = v[4] + date = v[5] + title = v[6] + city = v[7] + jc_date = v[8] + wrongly = Wrongly(error=error, idea=idea, site=site, n_type=n_type, n_name=n_name, date=date, + title=title, city=city, jc_date=jc_date) + wrongly.save() + + except: + print(v) + + else: + messages.error(request, '请上传正确的文件类型!!!') + return HttpResponseRedirect('/backstage/backstage/error/') + return render(request, 'backstage/backstage-error.html') + + +def backstage_comment(request): + if request.method == 'POST': + filename = request.FILES.get('file') + if not os.path.exists(settings.MEDIA_ROOT): + os.makedirs(settings.MEDIA_ROOT) + if filename is None: + messages.error(request, '请选择要上传的文件!!!') + return HttpResponseRedirect('/backstage/backstage/comment/') + if str(filename).split('.')[1] == 'csv': + data = filename.read().decode("utf-8") + line = str(data).split('\n') + for l in line: + v = l.split(',') + try: + if v[0] != '评论': + print(v[0]) + comment = v[0] + reply = v[1] + name = v[2] + title = v[3] + date = v[4] + url = v[5] + comment = Comment(comment=comment, reply=reply, name=name, title=title, date=date, url=url) + comment.save() + + except: + print(v) + + else: + messages.error(request, '请上传正确的文件类型!!!') + return HttpResponseRedirect('/backstage/backstage/comment/') + return render(request, 'backstage/backstage-comment.html') diff --git a/dashboard/models.py b/dashboard/models.py index 8dffda5..ed2dd0b 100644 --- a/dashboard/models.py +++ b/dashboard/models.py @@ -762,10 +762,25 @@ class Wrongly(models.Model): n_name = models.CharField('新媒体名称', max_length=256, null=True, blank=True) date = models.CharField('发布时间', max_length=256, null=True, blank=True) title = models.CharField('标题', max_length=256, null=True, blank=True) - url = models.CharField('URL', max_length=256, null=True, blank=True) + city = models.CharField('市', max_length=256, null=True, blank=True) + jc_date = models.CharField('监测时间', max_length=256, null=True, blank=True) def __str__(self): return self.title -#时效性监测文件存储表 +#评论临时表 +class Comment(models.Model): + id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) + comment = models.TextField('评论', null=True, blank=True) + user = models.CharField('用户', max_length=256, null=True, blank=True) + reply = models.TextField('回复', null=True, blank=True) + name = models.CharField('新媒体名称',max_length=256, null=True, blank=True) + title = models.CharField('标题',max_length=256, null=True, blank=True) + date = models.CharField('时间',max_length=256, null=True, blank=True) + url = models.CharField('文章链接',max_length=256, null=True, blank=True) + created = models.DateTimeField('创建时间', auto_now_add=True) + updated = models.DateTimeField('更新时间', auto_now=True) + + def __str__(self): + return self.user diff --git a/dashboard/templates/dashboard/base/left.html b/dashboard/templates/dashboard/base/left.html index a1e060e..369cffa 100644 --- a/dashboard/templates/dashboard/base/left.html +++ b/dashboard/templates/dashboard/base/left.html @@ -165,30 +165,31 @@ 系统设置 -
  • - - - 后台管理 - - - -
  • + {% endif %} + {% endfor %} {#
  • #} {# #} {# #} diff --git a/dashboard/templates/dashboard/index.html b/dashboard/templates/dashboard/index.html index d8482ae..b1c5790 100644 --- a/dashboard/templates/dashboard/index.html +++ b/dashboard/templates/dashboard/index.html @@ -165,28 +165,28 @@
    -{#
    #} -{# 时间/更新篇数#} -{# SERVER UP#} -{#
    #} -{# Loading...#} -{#
    #} + {#
    #} + {# 时间/更新篇数#} + {# SERVER UP#} + {#
    #} + {# Loading...#} + {#
    #}
    新媒体数量/时间
    -{# USERS ONLINE#} -{#
    #} + {# USERS ONLINE#} + {#
    #}
    预警次数/时间
    -{# ORDERS / SALES#} -{#
    #} + {# ORDERS / SALES#} + {#
    #}
    @@ -237,7 +237,7 @@ -{# #} + {# #} @@ -372,6 +372,36 @@ $.getJSON('/monitor/index/newmedia/count/', function (res) { // 基于准备好的dom,初始化echarts实例 var myChart = echarts.init(document.getElementById('left2')); + var weixin = res.weixin + for (var i = 0; i < weixin.length; i++) { + if (weixin[i] != '3099') { + weixin[i] = 3099 + weixin[i] + } + } + var weibo = res.weibo + for (var i = 0; i < weibo.length; i++) { + if (weibo[i] != '774') { + weibo[i] = 774 + weibo[i] + } + } + var toutiao = res.toutiao + for (var i = 0; i < toutiao.length; i++) { + if (toutiao[i] != '615') { + toutiao[i] = 615 + toutiao[i] + } + } + var douyin = res.douyin + for (var i = 0; i < douyin.length; i++) { + if (douyin[i] != '451') { + douyin[i] = 451 + douyin[i] + } + } + var qita = res.qita + for (var i = 0; i < qita.length; i++) { + if (qita[i] != '295') { + qita[i] = 295 + qita[i] + } + } option = { {#title: {#} {# text: '新媒体数量/时间',#} @@ -407,31 +437,31 @@ name: '微信', type: 'line', stack: '总量', - data: res.weixin + data: weixin }, { name: '微博', type: 'line', stack: '总量', - data: res.weibo + data: weibo }, { name: '今日头条', type: 'line', stack: '总量', - data: res.toutiao + data: toutiao }, { name: '抖音', type: 'line', stack: '总量', - data: res.douyin + data: douyin }, { name: '其他', type: 'line', stack: '总量', - data: res.qita + data: qita } ] }; @@ -441,45 +471,118 @@ $.getJSON('/monitor/index/warning/count/', function (res) { // 基于准备好的dom,初始化echarts实例 var myChart = echarts.init(document.getElementById('left3')); + {#option = {#} + {#title: {#} + {# text: '新媒体数量/时间',#} + {# },#} + {# tooltip: {#} + {# trigger: 'axis'#} + {# },#} + {# legend: {#} + {# data: ['预警']#} + {# },#} + {# grid: {#} + {# left: '3%',#} + {# right: '6%',#} + {# bottom: '1%',#} + {# top: '20px',#} + {# containLabel: true#} + {# },#} + {# toolbox: {#} + {# feature: {#} + {# saveAsImage: {}#} + {# }#} + {# },#} + {# xAxis: {#} + {# type: 'category',#} + {# boundaryGap: false,#} + {# data: res.date_list#} + {# },#} + {# yAxis: {#} + {# type: 'value'#} + {# },#} + {# series: [#} + {# {#} + {# name: '预警',#} + {# type: 'line',#} + {# stack: '总量',#} + {# data: res.data#} + {# }#} + {# ]#} + {# };#} option = { - {#title: {#} - {# text: '新媒体数量/时间',#} - {# },#} tooltip: { - trigger: 'axis' + trigger: 'axis', + axisPointer: { + type: 'cross', + crossStyle: { + color: '#999' + } + } + }, + toolbox: { + feature: { + {#dataView: {show: true, readOnly: false},#} + magicType: {show: true, type: ['line', 'bar']}, + {#restore: {show: true},#} + {#saveAsImage: {show: true}#} + } }, legend: { - data: ['预警'] + data: ['监测报告', '预警账号'] }, grid: { left: '3%', right: '6%', bottom: '1%', - top: '20px', + top: '17px', containLabel: true }, - toolbox: { - feature: { - saveAsImage: {} + xAxis: [ + { + type: 'category', + data: res.date_list, + axisPointer: { + type: 'shadow' + } } - }, - xAxis: { - type: 'category', - boundaryGap: false, - data: res.date_list - }, - yAxis: { - type: 'value' - }, + ], + yAxis: [ + { + type: 'value', + name: '监测报告', + min: 0, + max: 1, + interval: 1, + {#axisLabel: {#} + {# formatter: '{value} ml'#} + {# }#} + }, + { + type: 'value', + name: '预警账号', + min: 0, + max: 25, + interval: 25 + {#axisLabel: {#} + {# formatter: '{value} °C'#} + {# }#} + } + ], series: [ { - name: '预警', - type: 'line', - stack: '总量', + name: '监测报告', + type: 'bar', + data: res.data + }, + { + name: '预警账号', + type: 'bar', data: res.data } ] }; + // 使用刚指定的配置项和数据显示图表。 myChart.setOption(option); }) diff --git a/dashboard/templates/dashboard/paginator/comment-management-paginate.html b/dashboard/templates/dashboard/paginator/comment-management-paginate.html new file mode 100644 index 0000000..c81e16e --- /dev/null +++ b/dashboard/templates/dashboard/paginator/comment-management-paginate.html @@ -0,0 +1,18 @@ +
    + +
    diff --git a/dashboard/views.py b/dashboard/views.py index d05fbca..a12437f 100644 --- a/dashboard/views.py +++ b/dashboard/views.py @@ -35,8 +35,11 @@ def refresh_captcha(request): to_json_response['new_cptch_image'] = captcha_image_url(to_json_response['new_cptch_key']) return JsonResponse(to_json_response) + def home(request): - return render(request,'dashboard/home.html') + return render(request, 'dashboard/home.html') + + def index(request): weixin_count = Weixin.objects.all().count() weibo_count = Weibo.objects.all().count() @@ -146,15 +149,15 @@ def improve_personal_information(request, pk): if Organization.objects.get(name=o): o_id = Organization.objects.get(name=o).id else: - messages.error(request,'您填写的单位不存在!!!') + messages.error(request, '您填写的单位不存在!!!') if request.POST.get('name'): name = request.POST.get('name') else: - messages.error(request,'请输入您的姓名!!!') + messages.error(request, '请输入您的姓名!!!') if request.POST.get('email'): email = request.POST.get('email') else: - messages.error(request,'请输入您的邮箱!!!') + messages.error(request, '请输入您的邮箱!!!') if request.FILES.get('image'): image = request.POST.get('image') else: @@ -162,14 +165,14 @@ def improve_personal_information(request, pk): if request.POST.get('password'): password = request.POST.get('password') else: - messages.error(request,'请输入密码') + messages.error(request, '请输入密码') confirm_password = request.POST.get('confirm_password') if password is not None and confirm_password is not None: if password == confirm_password: - User.objects.filter(id=pk).update(email=email,password=make_password(password)) - userprofile=Userprofile(name=name,image=image,organization_id=o_id,user_id=user.id) + User.objects.filter(id=pk).update(email=email, password=make_password(password)) + userprofile = Userprofile(name=name, image=image, organization_id=o_id, user_id=user.id) userprofile.save() - messages.success(request,'修改成功') + messages.success(request, '修改成功') return render(request, 'dashboard/user-improve-personal-information.html', {'usee': user}) @@ -251,7 +254,7 @@ def register(request): if res > 0: user_organization = Organization.objects.get(name=o).id else: - messages.error(request,'您填写的单位不存在') + messages.error(request, '您填写的单位不存在') if not request.POST.get('name'): messages.error(request, '请输入姓名') else: @@ -274,7 +277,7 @@ def register(request): else: confirm_password = request.POST.get('confirm_password') if not request.FILES.get('image'): - image='/profile/user_default.jpg' + image = '/profile/user_default.jpg' else: image = request.FILES.get('image') print(str(image) + "1111111111111111111111111111111111111111111") @@ -419,6 +422,8 @@ def import_user(request): except: print(phone) return HttpResponse('ok') + + @login_required def user_search_by_keyword(request): user = request.user @@ -429,29 +434,35 @@ def user_search_by_keyword(request): district = o.district keytype = request.POST.get('keytype') keyword = request.POST.get('ketword') - print(keytype,keyword) + print(keytype, keyword) userpaginator = None if level == 1: if keytype == '1': - userpaginator = Userprofile.objects.filter(name__contains=keyword,userprofile__organization__province=province) + userpaginator = Userprofile.objects.filter(name__contains=keyword, + userprofile__organization__province=province) elif keytype == '2': - userpaginator = Userprofile.objects.filter(organization__name__contains=keyword,userprofile__organization__province=province) + userpaginator = Userprofile.objects.filter(organization__name__contains=keyword, + userprofile__organization__province=province) elif level == 2: if keytype == '1': - userpaginator = Userprofile.objects.filter(name__contains=keyword,userprofile__organization__province=province, - userprofile__organization__cities=cities) + userpaginator = Userprofile.objects.filter(name__contains=keyword, + userprofile__organization__province=province, + userprofile__organization__cities=cities) elif keytype == '2': - userpaginator = Userprofile.objects.filter(organization__name__contains=keyword,userprofile__organization__province=province, - userprofile__organization__cities=cities) + userpaginator = Userprofile.objects.filter(organization__name__contains=keyword, + userprofile__organization__province=province, + userprofile__organization__cities=cities) elif level == 3: if keytype == '1': - userpaginator = Userprofile.objects.filter(name__contains=keyword,userprofile__organization__province=province, - userprofile__organization__cities=cities, - userprofile__organization__district=district) + userpaginator = Userprofile.objects.filter(name__contains=keyword, + userprofile__organization__province=province, + userprofile__organization__cities=cities, + userprofile__organization__district=district) elif keytype == '2': - userpaginator = Userprofile.objects.filter(organization__name__contains=keyword,userprofile__organization__province=province, - userprofile__organization__cities=cities, - userprofile__organization__district=district) + userpaginator = Userprofile.objects.filter(organization__name__contains=keyword, + userprofile__organization__province=province, + userprofile__organization__cities=cities, + userprofile__organization__district=district) elif level == 9: if keytype == '1': userpaginator = Userprofile.objects.filter(name__contains=keyword) @@ -466,7 +477,8 @@ def user_search_by_keyword(request): # userpaginator = paginator.page(1) # except EmptyPage: # userpaginator = paginator.page(paginator.num_pages) - user_count = userpaginator.count() + if userpaginator: + user_count = userpaginator.count() userallinfo = [] for u in userpaginator[:30]: o = dict() @@ -519,7 +531,8 @@ def user_search_by_keyword(request): userallinfo.append(o) print(userallinfo) return render(request, 'management/user-management.html', - {'userallinfo': userallinfo, 'userpaginator': userpaginator,'user_count':user_count}) + {'userallinfo': userallinfo, 'userpaginator': userpaginator, 'user_count': user_count}) + @login_required def news_search_by_keyword(request): @@ -528,19 +541,21 @@ def news_search_by_keyword(request): print(keytype, keyword) news = None if keytype == '1': - news = News.objects.filter(type='0',title__contains=keyword) + news = News.objects.filter(type='0', title__contains=keyword) elif keytype == '2': - news = News.objects.filter(type='1',title__contains=keyword) + news = News.objects.filter(type='1', title__contains=keyword) elif keytype == '3': - news = News.objects.filter(type='2',title__contains=keyword) + news = News.objects.filter(type='2', title__contains=keyword) elif keytype == '4': - news = News.objects.filter(type='3',title__contains=keyword) + news = News.objects.filter(type='3', title__contains=keyword) elif keytype == '5': - news = News.objects.filter(type='4',title__contains=keyword) + news = News.objects.filter(type='4', title__contains=keyword) elif keytype == '6': - news = News.objects.filter(type='5',title__contains=keyword) + news = News.objects.filter(type='5', title__contains=keyword) elif keytype == '7': - news = News.objects.filter(type='6',title__contains=keyword) + news = News.objects.filter(type='6', title__contains=keyword) + elif keytype == '0': + news = News.objects.filter(title__contains=keyword) news_list = [] news_count = news.count() for n in news[:30]: @@ -567,6 +582,7 @@ def news_search_by_keyword(request): return render(request, 'management/news-management.html', {'news': news_list, 'new': news, 'news_count': news_count}) + @login_required def organization_search_by_keyword(request): keytype = request.POST.get('keytype') @@ -583,14 +599,16 @@ def organization_search_by_keyword(request): res = [] if level == 1: if keytype == '1': - organization = Organization.objects.filter(province=province,name__contains=keyword).order_by('-created') + organization = Organization.objects.filter(province=province, name__contains=keyword).order_by('-created') elif level == 2: if keytype == '1': - organization = Organization.objects.filter(province=province, cities=cities,name__contains=keyword).order_by('-created') + organization = Organization.objects.filter(province=province, cities=cities, + name__contains=keyword).order_by('-created') elif level == 3: if keytype == '1': - organization = Organization.objects.filter(province=province, cities=cities, district=district,name__contains=keyword).order_by( - '-created') + organization = Organization.objects.filter(province=province, cities=cities, district=district, + name__contains=keyword).order_by( + '-created') elif level == 9: if keytype == '1': organization = Organization.objects.filter(name__contains=keyword).order_by('-created') @@ -628,7 +646,9 @@ def organization_search_by_keyword(request): organization_id=i.id).count() res.append(o) - return render(request, 'management/organization-management.html', {"organization": organization, 'res': res,'organization_count':organization_count}) + return render(request, 'management/organization-management.html', + {"organization": organization, 'res': res, 'organization_count': organization_count}) + @login_required def weixin_search_by_keyword(request): @@ -644,24 +664,28 @@ def weixin_search_by_keyword(request): res = [] if level == 1: if keytype == '1': - weixin = Weixin.objects.filter(organization__province=province,code__contains=keyword).order_by('-created') + weixin = Weixin.objects.filter(organization__province=province, code__contains=keyword).order_by('-created') elif keytype == '2': - weixin = Weixin.objects.filter(organization__province=province, organization__name__contains=keyword).order_by('-created') + weixin = Weixin.objects.filter(organization__province=province, + organization__name__contains=keyword).order_by('-created') elif level == 2: if keytype == '1': - weixin = Weixin.objects.filter(organization__province=province, organization__cities=cities,code__contains=keyword).order_by( - '-created') + weixin = Weixin.objects.filter(organization__province=province, organization__cities=cities, + code__contains=keyword).order_by( + '-created') elif keytype == '2': - weixin = Weixin.objects.filter(organization__province=province, organization__cities=cities, organization__name__contains=keyword).order_by( + weixin = Weixin.objects.filter(organization__province=province, organization__cities=cities, + organization__name__contains=keyword).order_by( '-created') elif level == 3: if keytype == '1': weixin = Weixin.objects.filter(organization__province=province, organization__cities=cities, - organization__district=district,code__contains=keyword).order_by( - '-created') + organization__district=district, code__contains=keyword).order_by( + '-created') elif keytype == '2': weixin = Weixin.objects.filter(organization__province=province, organization__cities=cities, - organization__district=district, organization__name__contains=keyword).order_by( + organization__district=district, + organization__name__contains=keyword).order_by( '-created') elif level == 9: if keytype == '1': @@ -707,7 +731,10 @@ def weixin_search_by_keyword(request): o['administrativedivision'] = str(Area_code_2020.objects.get(code=w.organization.province).name) o['status'] = w.status res.append(o) - return render(request, 'management/newmedia-management-edit-weixin.html', {'weixin': weixin, 'res': res,'weixin_count':weixin_count}) + return render(request, 'management/newmedia-management-edit-weixin.html', + {'weixin': weixin, 'res': res, 'weixin_count': weixin_count}) + + @login_required def weibo_search_by_keyword(request): keytype = request.POST.get('keytype') @@ -722,21 +749,25 @@ def weibo_search_by_keyword(request): res = [] if level == 1: if keytype == '1': - weibo = Weibo.objects.filter(organization__province=province,code__contains=keyword).order_by('-created') + weibo = Weibo.objects.filter(organization__province=province, code__contains=keyword).order_by('-created') elif keytype == '2': - weibo = Weibo.objects.filter(organization__province=province, organization__name__contains=keyword).order_by('-created') + weibo = Weibo.objects.filter(organization__province=province, + organization__name__contains=keyword).order_by('-created') elif level == 2: if keytype == '1': - weibo = Weibo.objects.filter(organization__province=province, organization__cities=cities,code__contains=keyword).order_by('-created') + weibo = Weibo.objects.filter(organization__province=province, organization__cities=cities, + code__contains=keyword).order_by('-created') elif keytype == '2': - weibo = Weibo.objects.filter(organization__province=province, organization__cities=cities,organization__name__contains=keyword).order_by('-created') + weibo = Weibo.objects.filter(organization__province=province, organization__cities=cities, + organization__name__contains=keyword).order_by('-created') elif level == 3: if keytype == '1': weibo = Weibo.objects.filter(organization__province=province, organization__cities=cities, - organization__district=district,code__contains=keyword).order_by('-created') + organization__district=district, code__contains=keyword).order_by('-created') elif keytype == '2': weibo = Weibo.objects.filter(organization__province=province, organization__cities=cities, - organization__district=district,organization__name__contains=keyword).order_by('-created') + organization__district=district, + organization__name__contains=keyword).order_by('-created') elif level == 9: if keytype == '1': weibo = Weibo.objects.filter(code__contains=keyword).order_by('-created') @@ -780,7 +811,9 @@ def weibo_search_by_keyword(request): o['administrativedivision'] = str(Area_code_2020.objects.get(code=w.organization.province).name) o['status'] = w.status res.append(o) - return render(request, 'management/newmedia-management-edit-weibo.html', {'weibo': weibo, 'res': res,'weibo_count':weibo_count}) + return render(request, 'management/newmedia-management-edit-weibo.html', + {'weibo': weibo, 'res': res, 'weibo_count': weibo_count}) + @login_required def toutiao_search_by_keyword(request): @@ -796,25 +829,27 @@ def toutiao_search_by_keyword(request): res = [] if level == 1: if keytype == '1': - toutiao = Toutiao.objects.filter(organization__province=province, code__contains=keyword).order_by('-created') + toutiao = Toutiao.objects.filter(organization__province=province, code__contains=keyword).order_by( + '-created') elif keytype == '2': toutiao = Toutiao.objects.filter(organization__province=province, - organization__name__contains=keyword).order_by('-created') + organization__name__contains=keyword).order_by('-created') elif level == 2: if keytype == '1': toutiao = Toutiao.objects.filter(organization__province=province, organization__cities=cities, - code__contains=keyword).order_by('-created') + code__contains=keyword).order_by('-created') elif keytype == '2': toutiao = Toutiao.objects.filter(organization__province=province, organization__cities=cities, - organization__name__contains=keyword).order_by('-created') + organization__name__contains=keyword).order_by('-created') elif level == 3: if keytype == '1': toutiao = Toutiao.objects.filter(organization__province=province, organization__cities=cities, - organization__district=district, code__contains=keyword).order_by('-created') + organization__district=district, code__contains=keyword).order_by( + '-created') elif keytype == '2': toutiao = Toutiao.objects.filter(organization__province=province, organization__cities=cities, - organization__district=district, - organization__name__contains=keyword).order_by('-created') + organization__district=district, + organization__name__contains=keyword).order_by('-created') elif level == 9: if keytype == '1': toutiao = Toutiao.objects.filter(code__contains=keyword).order_by('-created') @@ -858,7 +893,9 @@ def toutiao_search_by_keyword(request): o['administrativedivision'] = str(Area_code_2020.objects.get(code=w.organization.province).name) o['status'] = w.status res.append(o) - return render(request, 'management/newmedia-management-edit-toutiao.html', {'toutiao': toutiao, 'res': res,'toutiao_count':toutiao_count}) + return render(request, 'management/newmedia-management-edit-toutiao.html', + {'toutiao': toutiao, 'res': res, 'toutiao_count': toutiao_count}) + @login_required def douyin_search_by_keyword(request): @@ -877,22 +914,22 @@ def douyin_search_by_keyword(request): douyin = Douyin.objects.filter(organization__province=province, code__contains=keyword).order_by('-created') elif keytype == '2': douyin = Douyin.objects.filter(organization__province=province, - organization__name__contains=keyword).order_by('-created') + organization__name__contains=keyword).order_by('-created') elif level == 2: if keytype == '1': douyin = Douyin.objects.filter(organization__province=province, organization__cities=cities, - code__contains=keyword).order_by('-created') + code__contains=keyword).order_by('-created') elif keytype == '2': douyin = Douyin.objects.filter(organization__province=province, organization__cities=cities, - organization__name__contains=keyword).order_by('-created') + organization__name__contains=keyword).order_by('-created') elif level == 3: if keytype == '1': douyin = Douyin.objects.filter(organization__province=province, organization__cities=cities, - organization__district=district, code__contains=keyword).order_by('-created') + organization__district=district, code__contains=keyword).order_by('-created') elif keytype == '2': douyin = Douyin.objects.filter(organization__province=province, organization__cities=cities, - organization__district=district, - organization__name__contains=keyword).order_by('-created') + organization__district=district, + organization__name__contains=keyword).order_by('-created') elif level == 9: if keytype == '1': douyin = Douyin.objects.filter(code__contains=keyword).order_by('-created') @@ -939,6 +976,7 @@ def douyin_search_by_keyword(request): return render(request, 'management/newmedia-management-edit-douyin.html', {'douyin': douyin, 'res': res, 'douyin_count': douyin_count}) + @login_required def qita_search_by_keyword(request): keytype = request.POST.get('keytype') @@ -953,22 +991,26 @@ def qita_search_by_keyword(request): res = [] if level == 1: if keytype == '1': - qita = Qita.objects.filter(organization__province=province,code__contains=keyword).order_by('-created') + qita = Qita.objects.filter(organization__province=province, code__contains=keyword).order_by('-created') elif keytype == '2': - qita = Qita.objects.filter(organization__province=province,organization__name__contains=keyword).order_by('-created') + qita = Qita.objects.filter(organization__province=province, organization__name__contains=keyword).order_by( + '-created') elif level == 2: if keytype == '1': - qita = Qita.objects.filter(organization__province=province, organization__cities=cities,code__contains=keyword).order_by('-created') + qita = Qita.objects.filter(organization__province=province, organization__cities=cities, + code__contains=keyword).order_by('-created') elif keytype == '2': - qita = Qita.objects.filter(organization__province=province, organization__cities=cities,organization__name__contains=keyword).order_by( + qita = Qita.objects.filter(organization__province=province, organization__cities=cities, + organization__name__contains=keyword).order_by( '-created') elif level == 3: if keytype == '1': qita = Qita.objects.filter(organization__province=province, organization__cities=cities, - organization__district=district,code__contains=keyword).order_by('-created') + organization__district=district, code__contains=keyword).order_by('-created') elif keytype == '2': qita = Qita.objects.filter(organization__province=province, organization__cities=cities, - organization__district=district,organization__name__contains=keyword).order_by('-created') + organization__district=district, organization__name__contains=keyword).order_by( + '-created') elif level == 9: if keytype == '1': qita = Qita.objects.filter(code__contains=keyword).order_by('-created') @@ -1013,7 +1055,9 @@ def qita_search_by_keyword(request): o['administrativedivision'] = str(Area_code_2020.objects.get(code=w.organization.province).name) o['status'] = w.status res.append(o) - return render(request, 'management/newmedia-management-edit-qita.html', {'qita': qita, 'res': res,'qita_count':qita_count}) + return render(request, 'management/newmedia-management-edit-qita.html', + {'qita': qita, 'res': res, 'qita_count': qita_count}) + @login_required def group_init_search_by_keyword(request): @@ -1023,9 +1067,9 @@ def group_init_search_by_keyword(request): user = request.user level = Userprofile.objects.get(user_id=user.id).organization.level.level if keytype == '1': - group_initer = Group.objects.filter(user_id=user.id,name__contains=keyword).order_by('-created') + group_initer = Group.objects.filter(user_id=user.id, name__contains=keyword).order_by('-created') elif keytype == '2': - group_initer = Group.objects.filter(user_id=user.id,type__type__contains=keyword).order_by('-created') + group_initer = Group.objects.filter(user_id=user.id, type__type__contains=keyword).order_by('-created') print(group_initer) res_g_i = [] init_count = group_initer.count() @@ -1042,6 +1086,7 @@ def group_init_search_by_keyword(request): return render(request, 'management/group-management-init.html', {'group': group_initer, 'res_g_i': res_g_i, 'init_count': init_count, 'level': level}) + @login_required def group_admin_search_by_keyword(request): keytype = request.POST.get('keytype') @@ -1051,9 +1096,9 @@ def group_admin_search_by_keyword(request): group_admin_list = [] g = None if keytype == '1': - g = Group_admin.objects.filter(user_id=user.id,group__name__contains=keyword).order_by('-created') + g = Group_admin.objects.filter(user_id=user.id, group__name__contains=keyword).order_by('-created') elif keytype == '2': - g = Group_admin.objects.filter(user_id=user.id,group__type__type__contains=keyword).order_by('-created') + g = Group_admin.objects.filter(user_id=user.id, group__type__type__contains=keyword).order_by('-created') for g_a in g: group_admin = Group.objects.get(id=g_a.group_id) group_admin_list.append(group_admin) @@ -1072,6 +1117,7 @@ def group_admin_search_by_keyword(request): return render(request, 'management/group-management-admin.html', {'group': group_admin_list, 'res_g_a': res_g_a, 'admin_count': admin_count, 'level': level}) + @login_required def group_user_search_by_keyword(request): keytype = request.POST.get('keytype') @@ -1080,9 +1126,9 @@ def group_user_search_by_keyword(request): level = Userprofile.objects.get(user_id=user.id).organization.level.level group_user_list = [] if keytype == '1': - g = Group_user.objects.filter(user_id=user.id,group__name__contains=keyword).order_by('-created') + g = Group_user.objects.filter(user_id=user.id, group__name__contains=keyword).order_by('-created') elif keytype == '2': - g = Group_user.objects.filter(user_id=user.id,group__type__type__contains=keyword).order_by('-created') + g = Group_user.objects.filter(user_id=user.id, group__type__type__contains=keyword).order_by('-created') for g_u in g: group_user = Group.objects.get(id=g_u.group_id) group_user_list.append(group_user) @@ -1101,6 +1147,7 @@ def group_user_search_by_keyword(request): return render(request, 'management/group-management-user.html', {'group': group_user_list, 'res_g_u': res_g_u, 'user_count': user_count, 'level': level}) + @login_required def group_super_search_by_keyword(request): keytype = request.POST.get('keytype') @@ -1127,9 +1174,10 @@ def group_super_search_by_keyword(request): return render(request, 'management/group-management-superuser.html', {'group': group, 'res_g_i': res_g_i, 'count': count, 'level': level}) + def app_download(request): file = open('/var/www/p3/newmediamonitoring/media/app-10.apk', 'rb') response = HttpResponse(file) response['Content-Type'] = 'application/octet-stream' response['Content-Disposition'] = 'attachment;filename="app.apk"' - return response \ No newline at end of file + return response diff --git a/management/templates/management/group-management-admin.html b/management/templates/management/group-management-admin.html index d69b747..ab6e87f 100644 --- a/management/templates/management/group-management-admin.html +++ b/management/templates/management/group-management-admin.html @@ -113,9 +113,9 @@ {% endfor %} -
    - {% include 'dashboard/paginator/group-management-paginate.html' %} -
    +{#
    #} +{# {% include 'dashboard/paginator/group-management-paginate.html' %}#} +{#
    #} diff --git a/management/templates/management/group-management-init.html b/management/templates/management/group-management-init.html index d6a10b0..9a12cfc 100644 --- a/management/templates/management/group-management-init.html +++ b/management/templates/management/group-management-init.html @@ -113,9 +113,9 @@ {% endfor %} -
    - {% include 'dashboard/paginator/group-management-paginate.html' %} -
    +{#
    #} +{# {% include 'dashboard/paginator/group-management-paginate.html' %}#} +{#
    #} diff --git a/management/templates/management/group-management-superuser.html b/management/templates/management/group-management-superuser.html index 24e9318..b4a8321 100644 --- a/management/templates/management/group-management-superuser.html +++ b/management/templates/management/group-management-superuser.html @@ -113,9 +113,9 @@ {% endfor %} -
    - {% include 'dashboard/paginator/group-management-paginate.html' %} -
    +{#
    #} +{# {% include 'dashboard/paginator/group-management-paginate.html' %}#} +{#
    #} diff --git a/management/templates/management/group-management-user.html b/management/templates/management/group-management-user.html index fbbf4bc..f292564 100644 --- a/management/templates/management/group-management-user.html +++ b/management/templates/management/group-management-user.html @@ -106,9 +106,9 @@ {% endfor %} -
    - {% include 'dashboard/paginator/group-management-paginate.html' %} -
    +{#
    #} +{# {% include 'dashboard/paginator/group-management-paginate.html' %}#} +{#
    #} diff --git a/management/templates/management/newmedia-management-edit-douyin.html b/management/templates/management/newmedia-management-edit-douyin.html index c681fee..f36b6af 100644 --- a/management/templates/management/newmedia-management-edit-douyin.html +++ b/management/templates/management/newmedia-management-edit-douyin.html @@ -82,9 +82,9 @@ {% endfor %} -
    - {% include 'dashboard/paginator/douyin-management-paginate.html' %} -
    +{#
    #} +{# {% include 'dashboard/paginator/douyin-management-paginate.html' %}#} +{#
    #} diff --git a/management/templates/management/newmedia-management-edit-qita.html b/management/templates/management/newmedia-management-edit-qita.html index b0b4f2f..a3e64bf 100644 --- a/management/templates/management/newmedia-management-edit-qita.html +++ b/management/templates/management/newmedia-management-edit-qita.html @@ -85,9 +85,9 @@ {% endfor %} -
    - {% include 'dashboard/paginator/qita-management-paginate.html' %} -
    +{#
    #} +{# {% include 'dashboard/paginator/qita-management-paginate.html' %}#} +{#
    #} diff --git a/management/templates/management/newmedia-management-edit-toutiao.html b/management/templates/management/newmedia-management-edit-toutiao.html index acd3659..ae7cde6 100644 --- a/management/templates/management/newmedia-management-edit-toutiao.html +++ b/management/templates/management/newmedia-management-edit-toutiao.html @@ -82,9 +82,9 @@ {% endfor %} -
    - {% include 'dashboard/paginator/toutiao-management-paginate.html' %} -
    +{#
    #} +{# {% include 'dashboard/paginator/toutiao-management-paginate.html' %}#} +{#
    #} diff --git a/management/templates/management/newmedia-management-edit-weibo.html b/management/templates/management/newmedia-management-edit-weibo.html index 0e95f85..10fe10e 100644 --- a/management/templates/management/newmedia-management-edit-weibo.html +++ b/management/templates/management/newmedia-management-edit-weibo.html @@ -83,9 +83,9 @@ {% endfor %} -
    - {% include 'dashboard/paginator/weibo-management-paginate.html' %} -
    +{#
    #} +{# {% include 'dashboard/paginator/weibo-management-paginate.html' %}#} +{#
    #} diff --git a/management/templates/management/newmedia-management-edit-weixin.html b/management/templates/management/newmedia-management-edit-weixin.html index 554b610..a9c5997 100644 --- a/management/templates/management/newmedia-management-edit-weixin.html +++ b/management/templates/management/newmedia-management-edit-weixin.html @@ -82,9 +82,9 @@ {% endfor %} -
    - {% include 'dashboard/paginator/weixin-management-paginate.html' %} -
    +{#
    #} +{# {% include 'dashboard/paginator/weixin-management-paginate.html' %}#} +{#
    #} diff --git a/management/templates/management/news-management.html b/management/templates/management/news-management.html index 0a63af3..ab76234 100644 --- a/management/templates/management/news-management.html +++ b/management/templates/management/news-management.html @@ -45,6 +45,7 @@
    {% csrf_token %}