コード例 #1
0
ファイル: views.py プロジェクト: liwanlei/FXTest
 def get(self, page=1):
     if current_user.is_sper is True:
         task = []
         task.append(
             Task.query.filter_by(status=False).order_by(
                 Task.id.desc()).all())
     else:
         task = []
         id = []
         for project in current_user.quanxians:
             if (project.projects.id in id) is False:
                 task.append(
                     Task.query.filter_by(prject=project.projects.id,
                                          status=False).all())
                 id.append(project.projects.id)
     old_yask = hebinglist(task)
     projects_lsit = fenye_list(Ob_list=old_yask, split=PageShow)
     pages = range(1, len(projects_lsit) + 1)
     try:
         pyth_post1 = projects_lsit[int(page) - 1]
         return render_template('home/timingtask.html',
                                inte=pyth_post1,
                                pages=pages)
     except Exception as e:
         logger.error(e)
         return redirect(url_for('home.timingtask'))
コード例 #2
0
ファイル: views.py プロジェクト: liwanlei/FXTest
 def get(self):
     wrok = Work.query.all()
     projects = Project.query.filter_by(status=False).all()
     if current_user.is_sper is True:
         pagination = (User.query.order_by(User.id.desc()).all())
     else:
         pagination = []
         id = []
         for projec in current_user.quanxians:
             if (projec.user.all() in id) is False:
                 pagination.append(projec.user.all())
                 id.append(projec.user.all())
         pagination = (hebinglist(pagination))
     pager_obj = Pagination(request.args.get("page", 1),
                            len(pagination),
                            request.path,
                            request.args,
                            per_page_count=PageShow)
     index_list = pagination[pager_obj.start:pager_obj.end]
     html = pager_obj.page_html()
     return render_template('home/useradmin.html',
                            users=index_list,
                            html=html,
                            wroks=wrok,
                            projects=projects)