#用户登录、数据库修改

This commit is contained in:
Bob 2020-08-26 09:58:16 +08:00
parent aa1833d3ab
commit ccf4574212
16 changed files with 600 additions and 60 deletions

View File

@ -42,7 +42,8 @@ INSTALLED_APPS = [
'bootstrap3',
'captcha',
'dashboard',
'management'
'management',
'monitor'
]
MIDDLEWARE = [

View File

@ -21,5 +21,6 @@ urlpatterns = [
path('admin/', admin.site.urls),
path('', include('dashboard.urls')),
path('captcha/', include('captcha.urls')),
path('management/', include('management.urls'))
path('management/', include('management.urls')),
path('monitor/',include('monitor.urls'))
]

View File

@ -1,7 +1,7 @@
from django.contrib import admin
# Register your models here.
from dashboard.models import Userprofile, Organization, Group, Level, Organizationtype, Group_type
from dashboard.models import Userprofile, Organization, Group, Level, Organizationtype, Group_type, Weixin_data
class UserProfileAdmin(admin.ModelAdmin):
@ -28,3 +28,6 @@ admin.site.register(Organizationtype,OrganizationtypeAdmin)
class Group_typeAdmin(admin.ModelAdmin):
list_display = ('id',)
admin.site.register(Group_type,Group_typeAdmin)
class Weixin_data_typeAdmin(admin.ModelAdmin):
list_display = ('id',)
admin.site.register(Weixin_data,Weixin_data_typeAdmin)

View File

@ -210,7 +210,7 @@ class Weibo(models.Model):
# 微博文章采集
class Weibi_data(models.Model):
class Weibo_data(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
weiboid = models.CharField('微博ID', max_length=256, null=True, blank=True)
content = models.TextField('正文', null=True, blank=True)

View File

@ -1,5 +1,4 @@
<div class="page-sidebar-wrapper" id="main-menu-wrapper" style="min-height: 1000px">
<!-- USER INFO - START -->
<div class="profile-info row">
@ -30,7 +29,7 @@
<ul class='wraplist'>
<li class="">
<a href="{% url 'user-management-update' user.id %}">
<a href="{% url 'monitor-new-media-public-opinion-weixin' %}">
<i class="fa fa-th"></i>
<span class="title">新媒体舆情</span>
</a>
@ -46,6 +45,9 @@
<li>
<a class="" href="">新媒体详情监测</a>
</li>
<li>
<a class="" href="">页面详情</a>
</li>
</ul>
</li>
<li class="">
@ -190,5 +192,4 @@
{# </li>#}
</ul>
</div>

0
monitor/__init__.py Normal file
View File

3
monitor/admin.py Normal file
View File

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

5
monitor/apps.py Normal file
View File

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

3
monitor/models.py Normal file
View File

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

View File

@ -0,0 +1,111 @@
{% 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 %}
</section>
<div class="chatapi-windows "></div>
<div class="panel panel-default">
<div class="panel-heading">
<ul class="nav nav-pills">
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-weixin' %}">微信</a>
</li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-toutiao' %}">头条</a>
</li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-weibo' %}">微博</a></li>
<li role="presentation" class="active"><a
href="{% url 'monitor-new-media-public-opinion-qita' %}">其他</a></li>
</ul>
</div>
<div class="panel-body">
<div class="panel panel-default">
<div class="panel-heading">微信热点</div>
<div class="panel-body">
<div class="col-lg-6" style="margin-top: 10px">
<div class="col-lg-3">
公众号
<select id="basicSelect">
<option value="qita_all">全部</option>
{% for q in qita %}
<option value="{{ q.id }}">{{ q.name }}</option>
{% endfor %}
</select>
</div>
<div class="col-lg-3">
分组
<select id="basicSelect">
<option value="group_all">全部</option>
{% for g in group %}
<option value="{{ g.id }}">{{ g.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="col-lg-6">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for...">
<span class="input-group-btn">
<button class="btn btn-default" type="button">Go!</button>
</span>
</div><!-- /input-group -->
</div>
</div>
<div class="panel panel-default">
<!-- Default panel contents -->
<table class="table table-hover" style="font-size: 14px">
<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 %}
<tr>
<td style="vertical-align: middle;text-align: center">{{ r.code }}</td>
<td style="vertical-align: middle;text-align: center"><img
src="{{ r.image.url }}" style="width: 40px;height: 40px;"
class="img-circle"></td>
<td style="vertical-align: middle;text-align: center">{{ r.title }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.comment }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.reply }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.date }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
</body>
{% endblock %}

View File

@ -0,0 +1,107 @@
{% 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 %}
</section>
<div class="chatapi-windows "></div>
<div class="panel panel-default">
<div class="panel-heading">
<ul class="nav nav-pills">
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-weixin' %}">微信</a></li>
<li role="presentation" class="active"><a href="{% url 'monitor-new-media-public-opinion-toutiao' %}">头条</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-weibo' %}">微博</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-qita' %}">其他</a></li>
</ul>
</div>
<div class="panel-body">
<div class="panel panel-default">
<div class="panel-heading">微信热点</div>
<div class="panel-body">
<div class="col-lg-6" style="margin-top: 10px">
<div class="col-lg-3">
公众号
<select id="basicSelect">
<option value="toutiao_all">全部</option>
{% for t in toutiao %}
<option value="{{ t.id }}">{{ t.code }}</option>
{% endfor %}
</select>
</div>
<div class="col-lg-3">
分组
<select id="basicSelect">
<option value="group_all">全部</option>
{% for g in group %}
<option value="{{ g.id }}">{{ g.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="col-lg-6">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for...">
<span class="input-group-btn">
<button class="btn btn-default" type="button">Go!</button>
</span>
</div><!-- /input-group -->
</div>
</div>
<div class="panel panel-default">
<!-- Default panel contents -->
<table class="table table-hover" style="font-size: 14px">
<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 %}
<tr>
<td style="vertical-align: middle;text-align: center">{{ r.code }}</td>
<td style="vertical-align: middle;text-align: center"><img src="{{ r.image.url }}" style="width: 40px;height: 40px;"
class="img-circle"></td>
<td style="vertical-align: middle;text-align: center">{{ r.title }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.comment }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.reply }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.date }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
</body>
{% endblock %}

View File

@ -0,0 +1,107 @@
{% 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 %}
</section>
<div class="chatapi-windows "></div>
<div class="panel panel-default">
<div class="panel-heading">
<ul class="nav nav-pills">
<li role="presentation" ><a href="{% url 'monitor-new-media-public-opinion-weixin' %}">微信</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-toutiao' %}">头条</a></li>
<li role="presentation" class="active"><a href="{% url 'monitor-new-media-public-opinion-weibo' %}">微博</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-qita' %}">其他</a></li>
</ul>
</div>
<div class="panel-body">
<div class="panel panel-default">
<div class="panel-heading">微信热点</div>
<div class="panel-body">
<div class="col-lg-6" style="margin-top: 10px">
<div class="col-lg-3">
公众号
<select id="basicSelect">
<option value="weibo_all">全部</option>
{% for w in weibo %}
<option value="{{ w.id }}">{{ w.code }}</option>
{% endfor %}
</select>
</div>
<div class="col-lg-3">
分组
<select id="basicSelect">
<option value="group_all">全部</option>
{% for g in group %}
<option value="{{ g.id }}">{{ g.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="col-lg-6">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for...">
<span class="input-group-btn">
<button class="btn btn-default" type="button">Go!</button>
</span>
</div><!-- /input-group -->
</div>
</div>
<div class="panel panel-default">
<!-- Default panel contents -->
<table class="table table-hover" style="font-size: 14px">
<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 %}
<tr>
<td style="vertical-align: middle;text-align: center">{{ r.code }}</td>
<td style="vertical-align: middle;text-align: center"><img src="{{ r.image.url }}" style="width: 40px;height: 40px;"
class="img-circle"></td>
<td style="vertical-align: middle;text-align: center">{{ r.title }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.comment }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.reply }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.date }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
</body>
{% endblock %}

View File

@ -0,0 +1,107 @@
{% 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 %}
</section>
<div class="chatapi-windows "></div>
<div class="panel panel-default">
<div class="panel-heading">
<ul class="nav nav-pills">
<li role="presentation" class="active"><a href="{% url 'monitor-new-media-public-opinion-weixin' %}">微信</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-toutiao' %}">头条</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-weibo' %}">微博</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-qita' %}">其他</a></li>
</ul>
</div>
<div class="panel-body">
<div class="panel panel-default">
<div class="panel-heading">微信热点</div>
<div class="panel-body">
<div class="col-lg-6" style="margin-top: 10px">
<div class="col-lg-3">
公众号
<select id="basicSelect">
<option value="weixin_all">全部</option>
{% for w in weixin %}
<option value="{{ w.id }}">{{ w.code }}</option>
{% endfor %}
</select>
</div>
<div class="col-lg-3">
分组
<select id="basicSelect">
<option value="group_all">全部</option>
{% for g in group %}
<option value="{{ g.id }}">{{ g.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="col-lg-6">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for...">
<span class="input-group-btn">
<button class="btn btn-default" type="button">Go!</button>
</span>
</div><!-- /input-group -->
</div>
</div>
<div class="panel panel-default">
<!-- Default panel contents -->
<table class="table table-hover" style="font-size: 14px">
<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 %}
<tr>
<td style="vertical-align: middle;text-align: center">{{ r.code }}</td>
<td style="vertical-align: middle;text-align: center"><img src="{{ r.image.url }}" style="width: 40px;height: 40px;"
class="img-circle"></td>
<td style="vertical-align: middle;text-align: center">{{ r.title }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.comment }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.reply }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.date }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
</body>
{% endblock %}

3
monitor/tests.py Normal file
View File

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

11
monitor/urls.py Normal file
View File

@ -0,0 +1,11 @@
from django.urls import path
from . import views
urlpatterns = [
#新媒体舆情
path('new/media/public/opinion/weixin/',views.new_media_public_opinion_weixin,name='monitor-new-media-public-opinion-weixin'),
path('new/media/public/opinion/weibo/',views.new_media_public_opinion_weibo,name='monitor-new-media-public-opinion-weibo'),
path('new/media/public/opinion/toutiao/',views.new_media_public_opinion_toutiao,name='monitor-new-media-public-opinion-toutiao'),
path('new/media/public/opinion/qita/',views.new_media_public_opinion_qita,name='monitor-new-media-public-opinion-qita'),
]

77
monitor/views.py Normal file
View File

@ -0,0 +1,77 @@
from django.shortcuts import render
# Create your views here.
from dashboard.models import Weixin, Weixin_data, Toutiao_data, Weibo_data, Qita_jc, Group, Toutiao, Weibo, Qita
def new_media_public_opinion_weixin(request):
weixin = Weixin.objects.all()
group = Group.objects.all()
weixin_data = Weixin_data.objects.all()
res = []
for w in weixin_data:
o = dict()
o['id'] = str(w.id)
o['code'] = w.weixin.code
o['image'] = w.weixin.image
o['title'] = w.title
o['comment'] = w.comment
o['reply'] = w.reply
o['date'] = w.date
res.append(o)
return render(request, 'monitor/new-media-public-opinion-weixin.html', {'res':res,'weixin':weixin,'group':group})
def new_media_public_opinion_toutiao(request):
toutiao = Toutiao.objects.all()
group = Group.objects.all()
toutiao_data = Toutiao_data.objects.all()
res = []
for t in toutiao_data:
o = dict()
o['id'] = str(t.id)
o['code'] = t.toutiao.code
o['image'] = t.toutiao.image
o['title'] = t.title
o['count'] = t.count
o['commentcount'] = t.commentcount
o['reply'] = t.reply
o['date'] = t.date
res.append(o)
return render(request, 'monitor/new-media-public-opinion-toutiao.html', {'res':res,'toutiao':toutiao,'group':group})
def new_media_public_opinion_weibo(request):
weibo = Weibo.objects.all()
group = Group.objects.all()
weibo_data = Weibo_data.objects.all()
res = []
for w in weibo_data:
o = dict()
o['id'] = str(w.id)
o['code'] = w.weibo.code
o['image'] = w.weibo.image
o['title'] = w.title
o['like'] = w.like
o['transpond'] = w.transpond
o['comment'] = w.comment
o['date'] = w.date
res.append(o)
return render(request, 'monitor/new-media-public-opinion-weibo.html', {'res':res,'weibo':weibo,'group':group})
def new_media_public_opinion_qita(request):
qita = Qita.objects.all()
group = Group.objects.all()
qita_jc = Qita_jc.objects.all()
res = []
for q in qita_jc:
o = dict()
o['id'] = str(q.id)
o['type'] = q.qita.type
o['name'] = q.qita.name
o['image'] = q.qita.image
o['count'] = q.count
o['count_jc'] = q.count_jc
o['comment'] = q.comment
o['reply'] = q.reply
o['date'] = q.date
res.append(o)
return render(request, 'monitor/new-media-public-opinion-qita.html', {'res':res,'qita':qita,'group':group})