示例#1
0
def admin_users_add():
    user = User()
    user.id = ''
    user.firstname = ''
    user.lastname = ''
    user.email = ''
    return render_admin('user.html', user=user)
示例#2
0
def admin_settings():
    available_themes = [
        x.identifier for x in get_themes_list() if x.identifier != 'admin']
    settings = Setting.all()
    for setting in settings:
        if setting.name == 'blog-theme':
            setting.allowed = json.dumps(available_themes)
    return render_admin('settings.html', settings=settings)
示例#3
0
def login():
    form = LoginForm()

    if form.validate_on_submit():
        user = User.query.filter_by(username=form.username.data).one()
        login_user(user)

        flash("Logged in successfully.", "success")
        return redirect(request.args.get("next") or url_for(".index"))

    return render_admin("login.html", form=form)
示例#4
0
def admin_posts_add():
    content = Content()
    content.published_on = datetime.now()
    content.body = ''
    content.title = ''
    content.tags = ''
    content.parser = 'markdown'
    content.type = 'post'
    content.user = g.user
    content.user_id = g.user.id

    return render_admin('content.html', user=g.user, content_type="Post",
                        action="Add", content=content)
示例#5
0
def admin_pages_add():
    content = Content()
    content.published_on = datetime.now()
    content.body = ''
    content.title = ''
    content.tags = ''
    content.parser = 'markdown'
    content.theme = g.theme
    content.type = 'page'
    content.user = g.user
    content.user_id = g.user.id
    themes = [t.identifier for t in get_themes_list() if t.identifier != 'admin']
    print(themes)
    return render_admin('content.html', user=g.user, content_type="Page",
                        action="Add", content=content, themes=themes)
示例#6
0
def admin():
    return render_admin('index.html', user=g.user)
示例#7
0
def admin_users_edit(user_id=''):
    user = User.get(user_id)
    return render_admin('user.html', user=user)
示例#8
0
def admin_users_list():
    users = User.filter(User.active == True).all()
    return render_admin('users_list.html', users=users, content_type="Pages")
示例#9
0
def admin_posts_list():
    contents = Content.filter(Content.type == 'post').order_by(
        Content.published_on.desc()).all()
    return render_admin('content_list.html', contents=contents, content_type="Posts")
示例#10
0
def admin_posts_edit(content_id):
    content = Content.get(content_id)
    return render_admin('content.html', user=g.user, content_type=content.type,
                        action="Edit", content=content)
示例#11
0
def admin_pages_edit(content_id):
    content = Content.get(content_id)
    themes = [t.identifier for t in get_themes_list() if t.identifier != 'admin']
    return render_admin('content.html', user=g.user, content_type=content.type,
                        action="Edit", content=content, themes=themes)
示例#12
0
def admin_files_add():
    return render_admin('file.html')
示例#13
0
def admin_files_list():
    files = File.all()
    return render_admin('files_list.html', files=files)