from django.shortcuts import render,redirect,HttpResponse
from app import models
import json,datetime,hashlib,uuid
# Create your views here.
from utils import call
from utils import query
from utils import user_page
from django.db import connection
import os
from django.db.models import Q
# '''初始化照片存放目录'''
query.creat_path()
def now_time():
n_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
return n_time
def uid():
uid = str (uuid.uuid1())
suid = ''.join (uid.split ('-'))
return suid
def login(request):
'''动态窗口'''
if request.method == 'POST':
dlfs = request.POST.get('key',None)
if dlfs == 'login':
data = call.dlfs_login(request)
return HttpResponse(json.dumps(data))
else:
return redirect ('/login.html')
session_key=request.session.session_key
request.session.delete(session_key)
date = call.login_select()
return render(request,'system/login.html',date)
def index(request):
if call.is_login (request):
user_id = request.session['user_id']
data = query.index_data(user_id)
count = user_page.dic_msg_num(user_id)
data['count'] = count
return render (request, 'system/index.html',data)
else:
return redirect ('/login.html')
def home(request):
if call.is_login(request):
return render(request,'system/home.html')
else:
return redirect ('/login.html')
def design(request):
'''登陆窗口页面'''
if call.is_login(request):
re_url = request.path_info
user_id = request.session['user_id']
if call.is_see_grant(request, re_url):
date = call.design_login(re_url,user_id)
return render(request, 'system/design.html', date)
else:
return render(request, 'system/403.html')
else:
return redirect ('/login.html')
def design_submit(request):
'''登陆窗口设置'''
if call.is_login(request):
re_url = request.POST.get('type', None)
re_date = request.POST
if call.is_see_grant(request, re_url):
if request.method == 'POST':
result = call.login_setting(request,re_date)
return HttpResponse(json.dumps(result))
else:
return HttpResponse(json.dumps(None))
else:
return HttpResponse(json.dumps(False))
else:
return redirect ('/login.html')
def theme(request):
'''桌面壁纸'''
if call.is_login(request):
re_url = request.path_info
if call.is_grant(request, re_url):
str_data = query.creat_theme(request,re_url)
menu_str = query.menu_theme(request, re_url)
return render(request,'system/theme.html',{'url_data': re_url,'data':str_data,'menu_str':menu_str})
else:
return render(request,'system/403.html')
else:
return redirect ('/login.html')
def theme_use(request):
'''桌面壁纸生效'''
if call.is_login(request) and request.method == 'POST':
re_url = request.POST.get('type', None)
if call.is_edit_grant(request, re_url):
theme_id = request.POST
models.SysTheme.objects.filter(id=theme_id['base']).update(state=1)
models.SysTheme.objects.exclude(id=theme_id['base']).update(state=0)
call.create_log(request, 'update', '修改了', '桌面壁纸')
return HttpResponse(json.dumps(True))
else:
return HttpResponse(json.dumps(False))
else:
return redirect ('/login.html')
def theme_detail(request):
'''桌面背景预览'''
if call.is_login(request):
re_url = request.GET.get('type', None)
user_id = request.session['user_id']
if call.is_see_grant(request, re_url):
date = call.theme_setting(request,re_url, user_id)
return render(request, 'system/theme_detail.html',date)
else:
return render(request, 'system/403.html')
else:
return redirect ('/login.html')
def theme_upload(request):
'''桌面壁纸上传接口'''
if call.is_login(request):
re_url = request.POST.get('type', None)
if call.is_edit_grant(request, re_url):
if call.upload_theme(request):
return HttpResponse(json.dumps(True))
else:
return HttpResponse(json.dumps(False))
else:
return HttpResponse(json.dumps(False))
else:
return redirect ('/login.html')
def theme_delete(request):
'''删除背景图片'''
if call.is_login(request) and request.method == 'POST':
re_url = request.POST.get('type', None)
if call.is_delete_grant(request, re_url):
theme_id = request.POST
image_path = models.SysTheme.objects.filter(id=theme_id['base'])
for path in image_path.values('full_path'):
if os.path.exists(path['full_path']):
os.remove(path['full_path'])
models.SysTheme.objects.filter(id=theme_id['base']).delete()
call.create_log(request, 'delete', '删除了', '一张桌面壁纸')
return HttpResponse(json.dumps(True))
else:
return HttpResponse(json.dumps(False))
else:
return redirect ('/login.html')
def information(request):
'''个人资料页面'''
if call.is_login(request):
return render(request,'system/information.html')
else:
return redirect ('/login.html')
def information_data(request):
if call.is_login(request):
base = []
user_id = request.session['user_id']
info_data=user_page.dic_msg(user_id)
for info in info_data.values('id','content','user_id','state','type'):
if info['state'] == 1:
info['state'] = '已读'
else:
info['state'] = '未读'
base.append(info)
data = {'code': 0, 'page_num': 1, 'bg_hs': 10, 'count': 0, 'data':base}
return HttpResponse(json.dumps(data))
else:
return redirect ('/login.html')
def information_del(request):
if call.is_login(request):
data = request.POST
try:
models.SysInformation.objects.filter(id=data['ID']).delete()
return HttpResponse(json.dumps(True))
except:
return HttpResponse(json.dumps(False))
else:
return redirect ('/login.html')
def information_update(request):
if call.is_login(request):
up_id = request.POST
if up_id['state'] == '未读':
models.SysInformation.objects.filter(id=up_id['ID']).update(state=1)
return HttpResponse(json.dumps(True))
else:
return HttpResponse(json.dumps(False))
else:
return redirect ('/login.html')
def role(request):
if call.is_login (request):
re_url = request.path_info
if call.is_grant(request,re_url):
sfkbj = call.see_grant(request, re_url)
return render (request, 'system/role.html',{'url_data': re_url,'anzs':sfkbj})
else:
return render(request,'system/403.html')
else:
return redirect ('/login.html')
def role_insert(request):
if call.is_login (request):
if request.method == 'POST':
re_url = request.POST.get('type', None)
if call.is_edit_grant(request, re_url):
temp = request.POST
models.SysRole.objects.create (id=call.uid(),caption = temp['base[name]'],abbreviation = temp['base[level]'],remark = temp['base[remark]'],pxh = temp['base[pxh]'])
call.create_log(request,'create','创建角色',temp['base[name]']
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
(基于python的毕业设计)棉花数据平台建设与可视化系统(django)(源码+说明+演示视频),本科毕业设计高分项目。 【项目技术】 python+Django+mysql 【实现功能】 本系统的开发用到了python技术、django架构和mysql数据库,系统界面简介,功能完整,具有内容可视化、病害管理、种类管理、棉植管理等等内容
资源推荐
资源详情
资源评论
收起资源包目录
(基于python的毕业设计)棉花数据平台建设与可视化系统(django)(源码+说明+演示视频).zip (1128个子文件)
layui.css 113KB
bootstrap.min.css 107KB
layui.css 78KB
style.default.css 75KB
layui.css 71KB
animate.min.css 50KB
ueditor.css 44KB
style_blog.css 42KB
font-awesome.css 37KB
admin.css 36KB
ueditor.min.css 34KB
font-awesome.min.css 32KB
prettyPhoto.css 26KB
bootstrap-override.css 22KB
bootstrap-editable.css 21KB
video-js.css 21KB
font-awesome.min.css 20KB
image.css 19KB
jquery-ui-1.10.3.css 19KB
select2.css 18KB
grid.css 17KB
video.css 15KB
attachment.css 15KB
layer.css 14KB
layer.css 14KB
layer.css 14KB
layer.css 14KB
video-js.min.css 11KB
animate.delay.css 11KB
dropzone.css 11KB
fullcalendar.css 10KB
layui.mobile.css 10KB
laydate.css 8KB
layui.mobile.css 8KB
normalize.css 8KB
laydate.css 7KB
laydate.css 7KB
laydate.css 7KB
shCoreDefault.css 7KB
demo.css 6KB
codemirror.css 6KB
weather-icons.min.css 5KB
toggles.css 5KB
colorpicker.css 5KB
jquery.datatables.css 5KB
scrawl.css 4KB
email.css 3KB
codemirror.css 3KB
reset.css 3KB
charts.css 3KB
background.css 2KB
bootstrap-timepicker.min.css 2KB
ambiance.css 2KB
chart.css 2KB
bootstrap-wysihtml5.css 2KB
emotion.css 2KB
dialogbase.css 2KB
login.css 2KB
music.css 2KB
comment.css 2KB
jquery.gritter.css 2KB
iconfont.css 1KB
nprogress.css 1KB
panel.css 1KB
code.css 1KB
column.css 1KB
login.css 1KB
edittable.css 1KB
jquery.tagsinput.css 1KB
code.css 1KB
code.css 1KB
code.css 1KB
template.css 1KB
pear.css 1KB
avatar.css 943B
page.css 751B
jquery-jvectormap-1.2.2.css 716B
webuploader.css 515B
morris.css 476B
help.css 395B
treetable.css 294B
style.css 221B
css3.css 67B
iframe.css 42B
var.css 0B
fontawesome-webfont.eot 162KB
fontawesome-webfont.eot 67KB
iconfont.eot 52KB
iconfont.eot 46KB
iconfont.eot 41KB
glyphicons-halflings-regular.eot 20KB
iconfont.eot 12KB
vjs.eot 3KB
UEditorSnapscreen.exe 508KB
wface.gif 49KB
jxface2.gif 40KB
yface.gif 28KB
bface.gif 27KB
left.gif 24KB
baoman_01.gif 24KB
共 1128 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12
资源评论
岛上程序猿
- 粉丝: 5575
- 资源: 4237
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- (源码)基于Spring Boot的极简易课堂对话系统.zip
- (源码)基于JSP+Servlet+MySQL的学生管理系统.zip
- (源码)基于ESP8266的蜂箱监测系统.zip
- (源码)基于Spring MVC和Hibernate框架的学校管理系统.zip
- (源码)基于TensorFlow 2.3的高光谱水果糖度分析系统.zip
- (源码)基于Python框架库的知识库管理系统.zip
- (源码)基于C++的日志管理系统.zip
- (源码)基于Arduino和OpenFrameworks的植物音乐感应系统.zip
- (源码)基于Spring Boot和Spring Security的博客管理系统.zip
- (源码)基于ODBC和C语言的数据库管理系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功