def admin_users_add(): user = User() user.id = '' user.firstname = '' user.lastname = '' user.email = '' return render_admin('user.html', user=user)
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)
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)
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)
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)
def admin(): return render_admin('index.html', user=g.user)
def admin_users_edit(user_id=''): user = User.get(user_id) return render_admin('user.html', user=user)
def admin_users_list(): users = User.filter(User.active == True).all() return render_admin('users_list.html', users=users, content_type="Pages")
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")
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)
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)
def admin_files_add(): return render_admin('file.html')
def admin_files_list(): files = File.all() return render_admin('files_list.html', files=files)