move mod_wsgi to passenger_wsgi
|
@ -18,11 +18,3 @@ from django.core.wsgi import get_wsgi_application
|
||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'NewMediaMonitoring.settings')
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'NewMediaMonitoring.settings')
|
||||||
sys.path.append("/var/www/p3/newmediamonitoring/current")
|
sys.path.append("/var/www/p3/newmediamonitoring/current")
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
||||||
try:
|
|
||||||
application = get_wsgi_application()
|
|
||||||
except Exception:
|
|
||||||
# Error loading applications
|
|
||||||
if 'mod_wsgi' in sys.modules:
|
|
||||||
traceback.print_exc()
|
|
||||||
os.kill(os.getpid(), signal.SIGINT)
|
|
||||||
time.sleep(2.5)
|
|
||||||
|
|
|
@ -18,3 +18,9 @@ source .venv/bin/activate
|
||||||
python manage.py make migrations
|
python manage.py make migrations
|
||||||
python manage.py migrate
|
python manage.py migrate
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# 查看服务器apache 内存使用情况
|
||||||
|
|
||||||
|
```shell
|
||||||
|
sudo /usr/sbin/passenger-memory-stats
|
||||||
|
```
|
|
@ -3,7 +3,17 @@ import uuid
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
# 权限等级
|
||||||
|
class Level(models.Model):
|
||||||
|
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
|
||||||
|
name = models.CharField('等级名', max_length=256, null=True, blank=True)
|
||||||
|
level = models.IntegerField('级别', blank=True, null=True,default=0)
|
||||||
|
created = models.DateTimeField('创建时间', auto_now_add=True)
|
||||||
|
updated = models.DateTimeField('更新时间', auto_now=True)
|
||||||
|
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
class Group_type(models.Model):
|
class Group_type(models.Model):
|
||||||
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
|
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
|
||||||
|
@ -55,17 +65,7 @@ class Group_user(models.Model):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.user.username
|
return self.user.username
|
||||||
# 权限等级
|
|
||||||
class Level(models.Model):
|
|
||||||
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
|
|
||||||
name = models.CharField('等级名', max_length=256, null=True, blank=True)
|
|
||||||
level = models.IntegerField('级别', blank=True, null=True,default=0)
|
|
||||||
created = models.DateTimeField('创建时间', auto_now_add=True)
|
|
||||||
updated = models.DateTimeField('更新时间', auto_now=True)
|
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return self.name
|
|
||||||
#单位类型
|
#单位类型
|
||||||
class Organizationtype(models.Model):
|
class Organizationtype(models.Model):
|
||||||
id = models.UUIDField('id',primary_key=True,default=uuid.uuid4)
|
id = models.UUIDField('id',primary_key=True,default=uuid.uuid4)
|
||||||
|
@ -104,6 +104,8 @@ class Userprofile(models.Model):
|
||||||
sex = models.CharField('性别', null=True, blank=True, max_length=256)
|
sex = models.CharField('性别', null=True, blank=True, max_length=256)
|
||||||
image = models.FileField(upload_to='profile', null=True, blank=True)
|
image = models.FileField(upload_to='profile', null=True, blank=True)
|
||||||
organization = models.ForeignKey(Organization, on_delete=models.CASCADE, null=True, blank=True)
|
organization = models.ForeignKey(Organization, on_delete=models.CASCADE, null=True, blank=True)
|
||||||
|
#用户状态:注册进来默认为0,为未审核状态,审核后status=1
|
||||||
|
status = models.IntegerField('用户状态',null=True,blank=True,default=0)
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
|
@ -352,7 +352,9 @@
|
||||||
</li>
|
</li>
|
||||||
<li class="chat-toggle-wrapper">
|
<li class="chat-toggle-wrapper">
|
||||||
{# <a href="#" data-toggle="chatbar" class="toggle_chat">#}
|
{# <a href="#" data-toggle="chatbar" class="toggle_chat">#}
|
||||||
<span>{{ user.first_name }}</span>
|
{% for i in user.userprofile_set.all %}
|
||||||
|
<span>{{ i.name }}</span>
|
||||||
|
{% endfor %}
|
||||||
{# <i class="fa fa-comments"></i>#}
|
{# <i class="fa fa-comments"></i>#}
|
||||||
{# <span class="badge badge-warning">9</span>#}
|
{# <span class="badge badge-warning">9</span>#}
|
||||||
{# </a>#}
|
{# </a>#}
|
||||||
|
|
|
@ -29,8 +29,14 @@
|
||||||
|
|
||||||
|
|
||||||
<ul class='wraplist'>
|
<ul class='wraplist'>
|
||||||
|
<li class="">
|
||||||
<li class="open">
|
<a href="{% url 'user-management-update' user.id %}">
|
||||||
|
<i class="fa fa-th"></i>
|
||||||
|
<span class="title">新媒体舆情</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{# <li class="open">#}
|
||||||
|
<li class="">
|
||||||
<a href="javascript:;">
|
<a href="javascript:;">
|
||||||
<i class="fa fa-map-marker"></i>
|
<i class="fa fa-map-marker"></i>
|
||||||
<span class="title">发布时效性监测</span>
|
<span class="title">发布时效性监测</span>
|
||||||
|
@ -44,13 +50,13 @@
|
||||||
</li>
|
</li>
|
||||||
<li class="">
|
<li class="">
|
||||||
<a href="">
|
<a href="">
|
||||||
<i class="fa fa-dashboard"></i>
|
<i class="fa fa-bar-chart"></i>
|
||||||
<span class="title">错别字监测</span>
|
<span class="title">错别字监测</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="">
|
<li class="">
|
||||||
<a href="javascript:;">
|
<a href="javascript:;">
|
||||||
<i class="fa fa-map-marker"></i>
|
<i class="fa fa-folder-open"></i>
|
||||||
<span class="title">敏感信息监测</span>
|
<span class="title">敏感信息监测</span>
|
||||||
<span class="arrow "></span>
|
<span class="arrow "></span>
|
||||||
</a>
|
</a>
|
||||||
|
@ -125,34 +131,34 @@
|
||||||
</li>
|
</li>
|
||||||
<li class="">
|
<li class="">
|
||||||
<a href="{% url 'user-management-management' %}">
|
<a href="{% url 'user-management-management' %}">
|
||||||
<i class="fa fa-dashboard"></i>
|
<i class="fa fa-columns"></i>
|
||||||
<span class="title">用户管理</span>
|
<span class="title">用户管理</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="">
|
<li class="">
|
||||||
<a href="">
|
<a href="{% url 'user-management-update' user.id %}">
|
||||||
<i class="fa fa-dashboard"></i>
|
<i class="fa fa-dashboard"></i>
|
||||||
<span class="title">系统设置</span>
|
<span class="title">系统设置</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="">
|
{# <li class="">#}
|
||||||
<a href="javascript:;">
|
{# <a href="javascript:;">#}
|
||||||
<i class="fa fa-columns"></i>
|
{# <i class="fa fa-columns"></i>#}
|
||||||
<span class="title">工作首页</span>
|
{# <span class="title">工作首页</span>#}
|
||||||
<span class="arrow "></span>
|
{# <span class="arrow "></span>#}
|
||||||
</a>
|
{# </a>#}
|
||||||
<ul class="sub-menu">
|
{# <ul class="sub-menu">#}
|
||||||
<li>
|
{# <li>#}
|
||||||
<a class="" href="">工作列表</a>
|
{# <a class="" href="">工作列表</a>#}
|
||||||
</li>
|
{# </li>#}
|
||||||
<li>
|
{# <li>#}
|
||||||
<a class="" href="">考勤管理</a>
|
{# <a class="" href="">考勤管理</a>#}
|
||||||
</li>
|
{# </li>#}
|
||||||
<li>
|
{# <li>#}
|
||||||
<a class="" href="">新闻管理</a>
|
{# <a class="" href="">新闻管理</a>#}
|
||||||
</li>
|
{# </li>#}
|
||||||
</ul>
|
{# </ul>#}
|
||||||
</li>
|
{# </li>#}
|
||||||
|
|
||||||
|
|
||||||
{# <li class=""><a href="javascript:;"> <i class="fa fa-folder-open"></i> <span class="title">Menu Levels</span>#}
|
{# <li class=""><a href="javascript:;"> <i class="fa fa-folder-open"></i> <span class="title">Menu Levels</span>#}
|
||||||
|
|
|
@ -51,7 +51,17 @@
|
||||||
<!-- START CONTENT -->
|
<!-- START CONTENT -->
|
||||||
<section id="main-content" class=" ">
|
<section id="main-content" class=" ">
|
||||||
<section class="wrapper" style='margin-top:60px;display:inline-block;width:100%;padding:15px 0 0 15px;'>
|
<section class="wrapper" style='margin-top:60px;display:inline-block;width:100%;padding:15px 0 0 15px;'>
|
||||||
|
{% if messages %}
|
||||||
|
<div class="alert alert-success alert-dismissible" role="alert">
|
||||||
|
<button type="button" class="close" data-dismiss="alert">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
<span class="sr-only">Close</span>
|
||||||
|
</button>
|
||||||
|
{% for message in messages %}
|
||||||
|
{{ message }}.<br/>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class='col-lg-12 col-md-12 col-sm-12 col-xs-12'>
|
<div class='col-lg-12 col-md-12 col-sm-12 col-xs-12'>
|
||||||
<div class="page-title">
|
<div class="page-title">
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
|
|
||||||
<form name="loginform" id="loginform" action="{% url 'dashboard-login' %}" method="post">{% csrf_token %}
|
<form name="loginform" id="loginform" action="{% url 'dashboard-login' %}" method="post">{% csrf_token %}
|
||||||
<p>
|
<p>
|
||||||
<label for="user_login">账号(您的邮箱、手机号或用户名)<br/>
|
<label for="user_login">账号(您注册的手机号)<br/>
|
||||||
<input type="text" name="username" id="user_login" class="input" size="20" placeholder="请输入账号"/></label>
|
<input type="text" name="username" id="user_login" class="input" size="20" placeholder="请输入账号"/></label>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -87,12 +87,12 @@
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<label for="phone">电话<br/>
|
<label for="phone">电话<br/>
|
||||||
<input type="text" name="phone" id="user_login" class="input" value="" size="20"/></label>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<label for="username">用户名<br/>
|
|
||||||
<input type="text" name="username" id="user_login" class="input" value="" size="20"/></label>
|
<input type="text" name="username" id="user_login" class="input" value="" size="20"/></label>
|
||||||
</p>
|
</p>
|
||||||
|
{# <p>#}
|
||||||
|
{# <label for="username">用户名<br/>#}
|
||||||
|
{# <input type="text" name="username" id="user_login" class="input" value="" size="20"/></label>#}
|
||||||
|
{# </p>#}
|
||||||
<p>
|
<p>
|
||||||
<label for="password">密码<br/>
|
<label for="password">密码<br/>
|
||||||
<input type="password" name="password" id="user_pass" class="input" value="" size="20"/></label>
|
<input type="password" name="password" id="user_pass" class="input" value="" size="20"/></label>
|
||||||
|
|
|
@ -48,10 +48,11 @@ def user_login(request):
|
||||||
except CaptchaStore.DoesNotExist:
|
except CaptchaStore.DoesNotExist:
|
||||||
messages.error(request, '验证码错误')
|
messages.error(request, '验证码错误')
|
||||||
return HttpResponseRedirect('/login/')
|
return HttpResponseRedirect('/login/')
|
||||||
|
print(username,password)
|
||||||
if username is not None and password is not None:
|
if username is not None and password is not None:
|
||||||
try:
|
try:
|
||||||
# user = authenticate(username=username, password=password)
|
user = authenticate(username=username, password=password)
|
||||||
user = User.objects.get(Q(username=username) | Q(first_name=username) | Q(email=username))
|
# user = User.objects.get(username=phone)
|
||||||
if user is not None:
|
if user is not None:
|
||||||
if user.check_password(password):
|
if user.check_password(password):
|
||||||
login(request, user)
|
login(request, user)
|
||||||
|
@ -61,7 +62,7 @@ def user_login(request):
|
||||||
else:
|
else:
|
||||||
messages.error(request, '账号或密码错误,请您确认账号和密码')
|
messages.error(request, '账号或密码错误,请您确认账号和密码')
|
||||||
except:
|
except:
|
||||||
messages.error(request, '账号或密码错误,请您确认账号和密码')
|
messages.error(request, '111')
|
||||||
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):
|
def user_logout(request):
|
||||||
logout(request)
|
logout(request)
|
||||||
|
@ -72,7 +73,7 @@ def register(request):
|
||||||
password = None
|
password = None
|
||||||
confirm_password = None
|
confirm_password = None
|
||||||
name = None
|
name = None
|
||||||
phone = None
|
# phone = None
|
||||||
image = None
|
image = None
|
||||||
flag = False
|
flag = False
|
||||||
o = None
|
o = None
|
||||||
|
@ -93,10 +94,10 @@ def register(request):
|
||||||
messages.error(request, '请输入邮箱')
|
messages.error(request, '请输入邮箱')
|
||||||
else:
|
else:
|
||||||
email = request.POST.get('email')
|
email = request.POST.get('email')
|
||||||
if not request.POST.get('phone'):
|
# if not request.POST.get('phone'):
|
||||||
messages.error(request, '请输入电话')
|
# messages.error(request, '请输入电话')
|
||||||
else:
|
# else:
|
||||||
phone = request.POST.get('phone')
|
# phone = request.POST.get('phone')
|
||||||
if not request.POST.get('username'):
|
if not request.POST.get('username'):
|
||||||
messages.error(request, '请输入用户名')
|
messages.error(request, '请输入用户名')
|
||||||
else:
|
else:
|
||||||
|
@ -115,9 +116,9 @@ def register(request):
|
||||||
else:
|
else:
|
||||||
image = request.FILES.get('image')
|
image = request.FILES.get('image')
|
||||||
print(str(image)+"1111111111111111111111111111111111111111111")
|
print(str(image)+"1111111111111111111111111111111111111111111")
|
||||||
if request.POST.get('sex') == 0:
|
if request.POST.get('sex') == '1':
|
||||||
sex = '男'
|
sex = '男'
|
||||||
else:
|
elif request.POST.get('sex') == '2':
|
||||||
sex = '女'
|
sex = '女'
|
||||||
captcha_input = request.POST.get('captcha_1')
|
captcha_input = request.POST.get('captcha_1')
|
||||||
captcha_hashkey = request.POST.get('captcha_0')
|
captcha_hashkey = request.POST.get('captcha_0')
|
||||||
|
@ -136,16 +137,16 @@ def register(request):
|
||||||
|
|
||||||
filter_result = User.objects.filter(username=username)
|
filter_result = User.objects.filter(username=username)
|
||||||
if len(filter_result) > 0:
|
if len(filter_result) > 0:
|
||||||
messages.error(request, '对不起,您输入的用户名已被注册')
|
messages.error(request, '对不起,您输入的电话号码已被注册')
|
||||||
return render(request, "dashboard/register.html")
|
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:
|
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_active = True
|
||||||
user.is_staff = True
|
# user.is_staff = True
|
||||||
user.first_name = phone
|
# user.first_name = phone
|
||||||
user.save()
|
user.save()
|
||||||
userprofile = Userprofile(name=name,image=image,user_id=user.id,organization_id=o,sex=sex)
|
userprofile = Userprofile(name=name,image=image,user_id=user.id,organization_id=o,sex=sex,status=0)
|
||||||
userprofile.save()
|
userprofile.save()
|
||||||
messages.success(request, '注册成功,请登录')
|
messages.success(request, '注册成功,请登录')
|
||||||
return HttpResponseRedirect('/login/')
|
return HttpResponseRedirect('/login/')
|
||||||
|
|
|
@ -0,0 +1,119 @@
|
||||||
|
{% extends 'dashboard/base/base.html' %}
|
||||||
|
{% load static %}
|
||||||
|
{% block content %}
|
||||||
|
<body class=" ">
|
||||||
|
<!-- START TOPBAR -->
|
||||||
|
|
||||||
|
<!-- START CONTAINER -->
|
||||||
|
<div class="page-container row-fluid">
|
||||||
|
|
||||||
|
<div class="page-sidebar ">
|
||||||
|
{% include 'dashboard/base/left.html' %}
|
||||||
|
</div>
|
||||||
|
<section id="main-content" class=" ">
|
||||||
|
<section class="wrapper" style='margin-top:60px;display:inline-block;width:100%;padding:15px 0 0 15px;'>
|
||||||
|
{% if messages %}
|
||||||
|
<div class="alert alert-success alert-dismissible" role="alert">
|
||||||
|
<button type="button" class="close" data-dismiss="alert">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
<span class="sr-only">Close</span>
|
||||||
|
</button>
|
||||||
|
{% for message in messages %}
|
||||||
|
{{ message }}.<br/>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class='col-lg-12 col-md-12 col-sm-12 col-xs-12'>
|
||||||
|
<div class="page-title">
|
||||||
|
|
||||||
|
<div class="pull-left">
|
||||||
|
<h1 class="title">系统设置</h1></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
|
||||||
|
<div class="col-lg-12 col-md-12 col-xs-12 col-sm-12">
|
||||||
|
<section class="box ">
|
||||||
|
<header class="panel_header">
|
||||||
|
<h2 class="title pull-left">用户信息</h2>
|
||||||
|
</header>
|
||||||
|
<div class="content-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8 col-sm-9 col-xs-10">
|
||||||
|
<form method="post"
|
||||||
|
action="{% url 'user-management-update' usee.id %}"
|
||||||
|
enctype="multipart/form-data">{% csrf_token %}
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label" for="organization">单位</label>
|
||||||
|
<div class="controls">
|
||||||
|
<select class="form-control" name="organization">
|
||||||
|
<option value="{{ userprofile.organization.id }}">{{ userprofile.organization.name }}</option>
|
||||||
|
{% for o in organization %}
|
||||||
|
<option value="{{ o.id }}">{{ o.name }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label" for="name">姓名</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" class="form-control" name="name"
|
||||||
|
value="{{ userprofile.name }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label" for="email">邮箱</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" class="form-control" name="email"
|
||||||
|
value="{{ usee.email }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label" for="username">电话</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" class="form-control" name="username"
|
||||||
|
value="{{ usee.username }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label" for="image">图标
|
||||||
|
<div class="controls">
|
||||||
|
<input type="file" name="image"><img
|
||||||
|
src="{{ userprofile.image.url }}"
|
||||||
|
style="width: 80px;height: 80px;"
|
||||||
|
class="img-circle">
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="passwordold">旧密码<br/>
|
||||||
|
<input type="password" name="passwordold" id="user_pass" class="input"
|
||||||
|
value="" size="20"/></label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="passwordnew">新密码<br/>
|
||||||
|
<input type="password" name="passwordnew" id="user_pass" class="input"
|
||||||
|
value="" size="20"/></label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="confirm_password">确认密码<br/>
|
||||||
|
<input type="password" name="confirm_password" id="user_pass1"
|
||||||
|
class="input" value=""
|
||||||
|
size="20"/></label>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary" style="margin-top: 50px">提交修改
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
<div class="chatapi-windows "></div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for u in userallinfo %}
|
{% for u in userallinfo %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="{{ u.image }}" style="width: 80px;height: 80px;"
|
<td><img src="{{ u.image.url }}" style="width: 80px;height: 80px;"
|
||||||
class="img-circle"></td>
|
class="img-circle"></td>
|
||||||
<td style="vertical-align: middle;text-align: center">{{ u.name }}</td>
|
<td style="vertical-align: middle;text-align: center">{{ u.name }}</td>
|
||||||
<td style="vertical-align: middle;text-align: center">{{ u.phone }}</td>
|
<td style="vertical-align: middle;text-align: center">{{ u.phone }}</td>
|
||||||
|
|
|
@ -6,6 +6,7 @@ urlpatterns = [
|
||||||
# 用户管理
|
# 用户管理
|
||||||
path('user/management/', views.user_management, name='user-management-management'),
|
path('user/management/', views.user_management, name='user-management-management'),
|
||||||
path('user/delete/<str:pk>/', views.user_delete, name='user-management-delete'),
|
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/', views.group_management, name='group-management-management'),
|
||||||
path('group/create/', views.group_create, name='group-management-create'),
|
path('group/create/', views.group_create, name='group-management-create'),
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
from django.contrib.auth.hashers import make_password
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
|
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
|
||||||
from django.http import HttpResponse, HttpResponseRedirect
|
from django.http import HttpResponse, HttpResponseRedirect
|
||||||
|
@ -24,9 +25,9 @@ def user_management(request):
|
||||||
for u in userpaginator:
|
for u in userpaginator:
|
||||||
o = dict()
|
o = dict()
|
||||||
o['id'] = str(u.id)
|
o['id'] = str(u.id)
|
||||||
o['image'] = u.userprofile_set.get(user_id=u.id).image.url
|
o['image'] = u.userprofile_set.get(user_id=u.id).image
|
||||||
o['name'] = u.userprofile_set.get(user_id=u.id).name
|
o['name'] = u.userprofile_set.get(user_id=u.id).name
|
||||||
o['phone'] = u.first_name
|
o['phone'] = u.username
|
||||||
o['organization'] = u.userprofile_set.get(user_id=u.id).organization.name
|
o['organization'] = u.userprofile_set.get(user_id=u.id).organization.name
|
||||||
o['type'] = u.userprofile_set.get(user_id=u.id).organization.organizationtype.organizationtype
|
o['type'] = u.userprofile_set.get(user_id=u.id).organization.organizationtype.organizationtype
|
||||||
organization_id = Userprofile.objects.get(user_id=u.id).organization_id
|
organization_id = Userprofile.objects.get(user_id=u.id).organization_id
|
||||||
|
@ -48,6 +49,51 @@ def user_delete(request, pk):
|
||||||
return HttpResponseRedirect('/management/user/management/')
|
return HttpResponseRedirect('/management/user/management/')
|
||||||
|
|
||||||
|
|
||||||
|
def user_update(request, pk):
|
||||||
|
user = User.objects.get(id=pk)
|
||||||
|
userprofile = Userprofile.objects.get(user_id=user.id)
|
||||||
|
organization = Organization.objects.all()
|
||||||
|
if request.method == 'POST':
|
||||||
|
organization_id = request.POST.get('organization')
|
||||||
|
name = request.POST.get('name')
|
||||||
|
email = request.POST.get('email')
|
||||||
|
username = request.POST.get('username')
|
||||||
|
image = request.FILES.get('image')
|
||||||
|
passwordold = request.POST.get('passwordold')
|
||||||
|
passwordnew = request.POST.get('passwordnew')
|
||||||
|
confirm_password = request.POST.get('confirm_password')
|
||||||
|
if passwordold is not None and passwordnew is not None and confirm_password is not None:
|
||||||
|
if passwordnew == confirm_password:
|
||||||
|
user.email = email
|
||||||
|
user.username = username
|
||||||
|
user.password = make_password(passwordnew)
|
||||||
|
userprofile.organization_id = organization_id
|
||||||
|
userprofile.name = name
|
||||||
|
if image is not None:
|
||||||
|
userprofile.image = image
|
||||||
|
user.save()
|
||||||
|
userprofile.save()
|
||||||
|
messages.success(request,"修改成功")
|
||||||
|
return HttpResponseRedirect("/")
|
||||||
|
else:
|
||||||
|
messages.error(request,'两次输入密码不一致')
|
||||||
|
return HttpResponseRedirect('/management/user/update/%s/' % (pk))
|
||||||
|
else:
|
||||||
|
user.email = email
|
||||||
|
user.username = username
|
||||||
|
userprofile.organization_id = organization_id
|
||||||
|
userprofile.name = name
|
||||||
|
if image is not None:
|
||||||
|
userprofile.image = image
|
||||||
|
user.save()
|
||||||
|
userprofile.save()
|
||||||
|
messages.success(request, "修改成功")
|
||||||
|
return HttpResponseRedirect("/")
|
||||||
|
|
||||||
|
return render(request, 'management/user-management-update.html',
|
||||||
|
{'usee': user, 'userprofile': userprofile, 'organization': organization})
|
||||||
|
|
||||||
|
|
||||||
def group_management(request):
|
def group_management(request):
|
||||||
group = Group.objects.all().order_by('-created')
|
group = Group.objects.all().order_by('-created')
|
||||||
paginator = Paginator(group, 6)
|
paginator = Paginator(group, 6)
|
||||||
|
@ -707,6 +753,7 @@ def newmedia_management_update_weixin(request, pk):
|
||||||
{'weixin': weixin, 'organization': organization,
|
{'weixin': weixin, 'organization': organization,
|
||||||
'weixin_status_choices_list': weixin_status_choices_list})
|
'weixin_status_choices_list': weixin_status_choices_list})
|
||||||
|
|
||||||
|
|
||||||
def newmedia_management_update_weibo(request, pk):
|
def newmedia_management_update_weibo(request, pk):
|
||||||
WEIBO_STATUS_CHOICES = Weibo.WEIBO_STATUS_CHOICES
|
WEIBO_STATUS_CHOICES = Weibo.WEIBO_STATUS_CHOICES
|
||||||
weibo_status_choices_list = []
|
weibo_status_choices_list = []
|
||||||
|
@ -836,26 +883,30 @@ def newmedia_management_update_qita(request, pk):
|
||||||
{'qita': qita, 'organization': organization,
|
{'qita': qita, 'organization': organization,
|
||||||
'qita_status_choices_list': qita_status_choices_list})
|
'qita_status_choices_list': qita_status_choices_list})
|
||||||
|
|
||||||
def newmedia_management_delete_weixin(request,pk):
|
|
||||||
|
def newmedia_management_delete_weixin(request, pk):
|
||||||
weixin = Weixin.objects.get(id=pk)
|
weixin = Weixin.objects.get(id=pk)
|
||||||
weixin.delete()
|
weixin.delete()
|
||||||
messages.success(request,"删除成功")
|
messages.success(request, "删除成功")
|
||||||
return HttpResponseRedirect('/management/newmedia/management/edit/weixin/')
|
return HttpResponseRedirect('/management/newmedia/management/edit/weixin/')
|
||||||
|
|
||||||
def newmedia_management_delete_weibo(request,pk):
|
|
||||||
|
def newmedia_management_delete_weibo(request, pk):
|
||||||
weibo = Weibo.objects.get(id=pk)
|
weibo = Weibo.objects.get(id=pk)
|
||||||
weibo.delete()
|
weibo.delete()
|
||||||
messages.success(request,"删除成功")
|
messages.success(request, "删除成功")
|
||||||
return HttpResponseRedirect('/management/newmedia/management/edit/weibo/')
|
return HttpResponseRedirect('/management/newmedia/management/edit/weibo/')
|
||||||
|
|
||||||
def newmedia_management_delete_toutiao(request,pk):
|
|
||||||
|
def newmedia_management_delete_toutiao(request, pk):
|
||||||
toutiao = Toutiao.objects.get(id=pk)
|
toutiao = Toutiao.objects.get(id=pk)
|
||||||
toutiao.delete()
|
toutiao.delete()
|
||||||
messages.success(request,"删除成功")
|
messages.success(request, "删除成功")
|
||||||
return HttpResponseRedirect('/management/newmedia/management/edit/toutiao/')
|
return HttpResponseRedirect('/management/newmedia/management/edit/toutiao/')
|
||||||
|
|
||||||
def newmedia_management_delete_qita(request,pk):
|
|
||||||
|
def newmedia_management_delete_qita(request, pk):
|
||||||
qita = Qita.objects.get(id=pk)
|
qita = Qita.objects.get(id=pk)
|
||||||
qita.delete()
|
qita.delete()
|
||||||
messages.success(request,"删除成功")
|
messages.success(request, "删除成功")
|
||||||
return HttpResponseRedirect('/management/newmedia/management/edit/qita/')
|
return HttpResponseRedirect('/management/newmedia/management/edit/qita/')
|
||||||
|
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
|
@ -0,0 +1,2 @@
|
||||||
|
import NewMediaMonitoring.wsgi
|
||||||
|
application = NewMediaMonitoring.wsgi.application
|
|
@ -21,7 +21,7 @@ class VerifyCode(models.Model):
|
||||||
|
|
||||||
def is_in_progress(self):
|
def is_in_progress(self):
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
return snow <= self.timeouted
|
return now <= self.timeouted
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.http import HttpResponse, JsonResponse
|
from django.http import HttpResponse, JsonResponse
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model, authenticate, login
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from django_token.models import Token
|
from django_token.models import Token
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from .models import VerifyCode
|
||||||
|
from .utils import generate_code, send_sms_code
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
username = request.GET.get('username')
|
username = request.GET.get('username')
|
||||||
|
|
|
@ -2340,7 +2340,7 @@ jQuery(function($) {
|
||||||
var i = 1,
|
var i = 1,
|
||||||
$custom_droplist = $("#custom-droptable"),
|
$custom_droplist = $("#custom-droptable"),
|
||||||
example_dropzone = $("#customDZ").dropzone({
|
example_dropzone = $("#customDZ").dropzone({
|
||||||
url: 'data/upload-file.php',
|
url: 'data/media-file.php',
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
addedfile: function(file) {
|
addedfile: function(file) {
|
||||||
|
|
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 7.4 KiB |