当前位置:网站首页>Flask blog practice - user management
Flask blog practice - user management
2022-06-22 08:31:00 【Light programming】
Through the functions in the previous sections , We should have been right flask_sqlalchemy I am very familiar with the addition, deletion, modification and query of , Then let's realize The last user management function , User management functions , We mainly show you how to realize flask Image upload function of And user password modification ideas and methods !
Create a user list view
route :app/admin/views.py
@bp.route('/user')
@login_required
def user():
# Check out the list of articles
page = request.args.get('page', 1, type=int)
pagination = User.query.order_by(-User.add_date).paginate(page, per_page=10, error_out=False)
user_list = pagination.items
return render_template('admin/user.html', user_list=user_list, pagination=pagination)This view is very simple , We have done the previous chapters many times , There is no need to repeat here !
Create add user view
You should create a form before creating an add view
stay app/admin/forms.py Create a CreateUserForm Form class for
from flask_wtf.file import FileField, FileRequired, FileSize, FileAllowed
class CreateUserForm(FlaskForm):
# create form
username = StringF边栏推荐
猜你喜欢

Five skills to be an outstanding cloud architect

开展有效的创客教育课程与活动

Some mathematical operation functions in LabVIEW

安装 MySQL 服务时提示 InstallRemove of the Service Denied
![luogu P4292 [WC2010]重建计划](/img/09/5417e0b62e5205c4dabf4571823492.png)
luogu P4292 [WC2010]重建计划

第八章 Web项目测试(此章完结)

Develop steam education based on scientific skills

Matplotlib | temperature change visualization

19 备忘录模式

Synchronized
随机推荐
Bit group sort
Mainstream design of database middleware
Some mathematical operation functions in LabVIEW
golang中使用swagger遇到的一些问题
How to select the appropriate partition key, routing rule and partition number
15 command mode
Type of sub database and sub table
14 responsibility chain mode
Introduction to bee's main functions and features
Matrix operation
Learn data warehouse together - Zero
luogu P5406 [THUPC2019]找树
Installing SQL Server 2008 by image in Windows Service 2008
Mysql+orcle (SQL implements recursive query of all data of child nodes)
Questions 1 to 100 of the national information security grade examination nisp level 1 question bank (1)
Mysql5.7 master-slave mode reference
Golang 开发 常用的第三方库 没有最全只有更全
C language implements inserting and reading pictures into MySQL
Flask博客实战 - 创建后台管理应用
Yolov5 reports an error: attributeerror: 'upsample' object has no attribute 'recommend_ scale_ Solution of 'factor'