def post(postid): posts = PostRepo() post = posts.getById(postid) if post == None: return abort(404) else: return render_template("view.html", post = post)
def new(): if request.method == 'POST': valid = validator.Validator() if valid.isValidPost(request) == True: posts = PostRepo() posts.insert({ "title": request.form["title"], "content": request.form["content"], "tags": request.form["tags"], "archive": request.form["archive"] }) return redirect(url_for('index')) else: tagsCloud = tags.Tags() return render_template( 'new.html', viewmodel = { "tagcloud" : tagsCloud.Cloud(), "errors" : valid.errors, "submittedValues" : valid.submittedValues }) else: tagsCloud = tags.Tags() return render_template( 'new.html', viewmodel = { "tagcloud" : tagsCloud.Cloud() })
def tag(tag): posts = PostRepo() allPosts = posts.getAllByTag(tag) return render_template('index.html', viewmodel = { "posts" : allPosts, "tagHeader" : tag })
def index(): postrepo = PostRepo() allPosts =postrepo.getAll() tagsCloud = tags.Tags() return render_template('index.html', viewmodel = { "posts" : allPosts, "tagcloud": tagsCloud.Cloud() })
def posts(): postsRepo = PostRepo() posts = postsRepo.getAllAndArchived() return render_template("posts.html", posts = posts)