Пример #1
0
def users():
    return render_template("users.html", users=User.all(sortby=User.name), backurl=None, current_user=current_user, authorizations=GroupOfAuthorization.all(sortby=GroupOfAuthorization.name))
Пример #2
0
def users():
    return render_template("users.html",
                           users=User.all(sortby=User.name),
                           backurl=None)
Пример #3
0
def addhistory(path=''):
    year = Book.all(sortby=Book.id)[0].year
    year_path = os.path.join(path, year)
    if os.path.isdir(year_path) is True:
        logging.info('delete %s' % year_path)
        rmtree(year_path)
    current_app.logger.info('create %s' % year_path)
    os.mkdir(year_path)
    current_app.logger.info('backup %s' % current_app.config["SQLALCHEMY_DATABASE_URI"][10:])
    copyfile(current_app.config["SQLALCHEMY_DATABASE_URI"][10:], os.path.join(year_path, 'jlat.db'))
    current_app.logger.info('write index for %s' % year)
    with open(os.path.join(year_path, "index.html"), "w") as index:
        index.write(render_template('archive_index.html', year=year))
    current_app.logger.info('write reviews for %s' % year)
    with open(os.path.join(year_path, "reviews.html"), "w") as review:
        review.write(render_template('archive_reviews.html', year=year, books=Book.all(sortby=Book.idext)))
    current_app.logger.info('write synth for %s' % year)
    with open(os.path.join(year_path, "synth.html"), "w") as synth:
        synth.write(render_template('archive_synth.html', year=year, books=Book.all(sortby=Book.idext), users=User.all(sortby=User.name)))
    for book in Book.all():
        book.remove()
    return redirect('/history')
Пример #4
0
def view():
    return render_template('synth.html',
                           books=Book.all(sortby=Book.idext),
                           users=User.all(sortby=User.name))