import os
import time
from flask import Blueprint, render_template, redirect, url_for, flash, request, abort
from flask_login import current_user, login_required
from flask_ckeditor import upload_success, upload_fail
from approval_system.extensions import db, archives, student_permission
from approval_system.forms import ApplyForm, MyApplyForm, FileApplyForm, CommentForm, ReApplyForm
from approval_system.models import Apply, Comment, Notice
from approval_system.utils import flash_errors, upload_file, file_path
user = Blueprint('user', __name__)
@user.route('/')
def index():
page = int(request.args.get('page', 1))
per_page = int(request.args.get('per_page', 8))
paginate = Notice.query.order_by(Notice.id.desc()).paginate(page, per_page, error_out=False)
notice = paginate.items
# from approval_system.models import User
# user1 = User(number='201508090009', name='Student1', dept_id=2, role_id=1, phone='10010001000')
# user1.set_password('admin')
# user2 = User(number='201508090079', name='Student2', dept_id=2, role_id=1, phone='10010001000')
# user2.set_password('admin')
# user3 = User(number='20150001', name='Teacher1', dept_id=2, role_id=2, phone='10010001000')
# user3.set_password('admin')
# user4 = User(number='20150002', name='Teacher2', dept_id=2, role_id=2, phone='10010001000')
# user4.set_password('admin')
# user5 = User(number='20150099', name='College1', dept_id=2, role_id=3, phone='10010001000')
# user5.set_password('admin')
# user6 = User(number='00000001', name='School1', dept_id=1, role_id=4, phone='10010001000')
# user6.set_password('admin')
# db.session.add(user1)
# db.session.add(user2)
# db.session.add(user3)
# db.session.add(user4)
# db.session.add(user5)
# db.session.add(user6)
# db.session.commit()
# print('测试数据插入OK')
return render_template('user/index.html', paginate=paginate, notice=notice)
@user.route('/notice/<int:id>/', methods=['GET', 'POST'])
def notice_id(id):
notice = Notice.query.get_or_404(id)
return render_template('user/notice_id.html', notice=notice)
@user.route('/all_apply/', methods=['GET'])
def all_apply():
page = int(request.args.get('page', 1))
per_page = int(request.args.get('per_page', 8))
paginate = Apply.query.order_by(Apply.id.desc()).paginate(page, per_page, error_out=False)
apply = paginate.items
return render_template('user/all_apply.html', paginate=paginate, apply=apply)
@user.route('/my_apply/', methods=['GET', 'POST'])
@login_required
@student_permission.require(http_exception=403)
def my_apply():
my_apply = Apply.query.filter(Apply.u_id == current_user.id).all()
return render_template('user/my_apply.html', my_apply=my_apply)
@user.route('/my_apply/<int:id>/', methods=['GET', 'POST'])
@login_required
@student_permission.require(http_exception=403)
def my_apply_id(id):
apply = Apply.query.get_or_404(id)
comments = Comment.query.filter_by(apply_id=id).all()
form = MyApplyForm()
file_form = FileApplyForm()
comment_form = CommentForm()
if apply.status_id % 2 == 0:
reapply_form = ReApplyForm()
else:
reapply_form = None
if form.submit1.data and form.validate_on_submit():
apply.name = form.name.data
apply.info = form.info.data
db.session.commit()
flash('更改项目信息成功', 'success')
return redirect(url_for('user.my_apply_id', id=id))
if file_form.submit2.data and file_form.validate_on_submit():
last_time = time.strftime('%Y-%m-%d_%H:%M:%S', time.localtime())
upload_file(last_time, id=id)
apply.last_time = last_time
db.session.commit()
flash('上传项目文件成功', 'success')
return redirect(url_for('user.my_apply_id', id=id))
if comment_form.submit3.data and comment_form.validate_on_submit():
body = comment_form.body.data
new_comment = Comment(body=body, author_id=current_user.id, apply_id=id)
db.session.add(new_comment)
db.session.commit()
return redirect(url_for('user.my_apply_id', id=id))
if reapply_form and reapply_form.submit0.data and reapply_form.validate_on_submit():
apply.status_id = 1
apply.t_id = reapply_form.t_id.data
apply.s_id, apply.c_id = None, None
apply.last_time = time.strftime('%Y-%m-%d_%H:%M:%S', time.localtime())
for i in comments:
db.session.delete(i)
db.session.commit()
flash('项目已重新申请', 'success')
return redirect(url_for('user.my_apply'))
flash_errors(file_form)
form.name.data = apply.name
form.info.data = apply.info
files_list = os.listdir(file_path(apply.inner_path))
return render_template('user/my_apply_id.html', form=form, file_form=file_form, comment_form=comment_form,
reapply_form=reapply_form, apply=apply, comments=comments, files_list=files_list)
@user.route('/apply/', methods=['GET', 'POST'])
@login_required
@student_permission.require(http_exception=403)
def apply():
form = ApplyForm()
if form.validate_on_submit():
name = form.name.data
info = form.info.data
t_id = form.t_id.data
last_time = time.strftime('%Y-%m-%d_%H:%M:%S', time.localtime())
apply = Apply(name=name, info=info, status_id=1, u_id=current_user.id, t_id=t_id, last_time=last_time)
db.session.add(apply)
db.session.commit()
apply.inner_path = current_user.number+'/'+str(apply.id)
db.session.commit()
upload_file(last_time, id=apply.id)
flash('提交项目申请成功', 'success')
return redirect(url_for('.my_apply'))
flash_errors(form)
return render_template('user/apply.html', form=form)
@login_required
@user.route('/upload', methods=['POST'])
def upload_image():
f = request.files.get('upload')
inner_path = current_user.number
f.save(file_path(inner_path)+'/'+f.filename)
url = archives.url(inner_path+'/'+f.filename)
return upload_success(url, f.filename)
@login_required
@user.route('/my_apply/open/', methods=['GET'])
def open_file():
inner_path = request.args.get('inner_path')
filename = request.args.get('filename')
file_url = archives.url(inner_path+'/'+filename)
return redirect(file_url)
@login_required
@student_permission.require(http_exception=403)
@user.route('/my_apply/delete/', methods=['GET'])
def delete_file():
inner_path = request.args.get('inner_path')
filename = request.args.get('filename')
file = archives.path(filename, folder=inner_path)
os.remove(file)
return redirect(request.referrer)
@user.route('/delete/comment/<int:comment_id>', methods=['GET'])
@login_required
def delete_comment(comment_id):
comment = Comment.query.get_or_404(comment_id)
if current_user != comment.author:
abort(403)
db.session.delete(comment)
db.session.commit()
return redirect(request.referrer)
没有合适的资源?快使用搜索试试~ 我知道了~
毕设 基于Flask的项目审批系统(Bootstrap+Mysql).zip
共531个文件
js:326个
html:63个
css:32个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 141 浏览量
2023-10-24
10:09:43
上传
评论
收藏 2.21MB ZIP 举报
温馨提示
matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行! matlab算法,毕设、课设程序,全部源码均已进行严格测试,可以直接运行!
资源推荐
资源详情
资源评论
收起资源包目录
毕设 基于Flask的项目审批系统(Bootstrap+Mysql).zip (531个子文件)
bootstrap.css 174KB
bootstrap.min.css 141KB
samples.css 64KB
bootstrap-grid.css 43KB
editor_ie8.css 36KB
editor_iequirks.css 36KB
editor_ie.css 35KB
editor_gecko.css 34KB
editor.css 34KB
bootstrap-grid.min.css 33KB
open-iconic-foundation.css 16KB
dialog_ie8.css 15KB
dialog_iequirks.css 14KB
dialog_ie.css 14KB
open-iconic-foundation.min.css 14KB
open-iconic.css 14KB
dialog.css 13KB
open-iconic.min.css 12KB
open-iconic-bootstrap.css 11KB
open-iconic-bootstrap.min.css 9KB
bootstrap-reboot.css 5KB
sample.css 5KB
bootstrap-reboot.min.css 4KB
contents.css 3KB
outputxhtml.css 2KB
fontello.css 2KB
wsc.css 1KB
toolbar.css 1KB
wsc.css 1KB
tableselection.css 1KB
dialog.css 396B
scayt.css 356B
open-iconic.eot 28KB
fontello.eot 5KB
outputforflash.fla 84KB
.flaskenv 48B
FONT-LICENSE 4KB
spinner.gif 3KB
.gitattributes 93B
.gitignore 1KB
.gitignore 9B
datafiltering.html 46KB
index.html 15KB
inlineall.html 10KB
outputforflash.html 10KB
toolbar.html 9KB
magicline.html 8KB
codesnippet.html 8KB
fullpage.html 8KB
jquery.html 7KB
dialog.html 7KB
outputhtml.html 7KB
api.html 7KB
replacebyclass.html 7KB
replacebycode.html 7KB
xhtmlstyle.html 7KB
index.html 7KB
inlinebycode.html 6KB
index.html 6KB
base.html 5KB
inlinetextarea.html 5KB
divreplace.html 4KB
uilanguages.html 4KB
enterkey.html 4KB
_comment.html 3KB
readonly.html 3KB
all_apply.html 3KB
ajax.html 3KB
uicolor.html 2KB
tabindex.html 2KB
notice_manager.html 2KB
appendto.html 2KB
my_apply_id.html 2KB
tmpFrameset.html 2KB
_pending_approval.html 2KB
my_apply.html 2KB
_approved.html 2KB
ciframe.html 2KB
user_manager.html 2KB
_notice.html 1KB
_pending_approval_id.html 1KB
publish_notice.html 844B
notice_manager_id.html 839B
apply.html 835B
400.html 737B
500.html 718B
404.html 711B
register_admin.html 708B
register.html 708B
403.html 706B
login.html 705B
password.html 638B
setting.html 638B
notice_id.html 604B
index.html 337B
pending_approval_id.html 169B
pending_approval_id.html 169B
pending_approval_id.html 169B
pending_approval.html 151B
pending_approval.html 151B
共 531 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
天天501
- 粉丝: 616
- 资源: 5906
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 无锁异步化、事件驱动架构设计的 java netty 网络编程框架; 轻量级,无需依赖任何第三方中间件或数据库就能支持集群、分布式; 适用于网络游戏服务器、物联网、内部系统及各种需要长连接的场景
- 单通道H桥马达驱动器T1016H的技术参数与应用指南
- 全国各地级市GDP、土地流转和耕地面积数据-最新出炉.zip
- ARM Cortex-M0+微控制器 CW32F030x6/x8 数据手册解析与应用指导
- 1/2.55英寸CMOS图像传感器IMX362的技术特性与应用
- 使用TensorFlow实现花卉分类识别系统
- SSS1700C1-USB Headset Line-in Controller Datasheet-v1.1-20241119
- ISO 14229-1:2020(E)
- Java企业级开发中数据结构的理解与应用
- Nginx Windows版本 自用
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功