def set_post(post,form): post.title=form.title.data if(post.url==None or post.url==''): post.url=post.slugify(post.title) else: post.url=post.slugify(post.url) post.description=form.description.data post.content=form.content.data post.post_type=form.post_type.data post.post_status=form.post_status.data post.author=User.get_by_id(session['user_id']) post.category=Category(name=form.category.data) my_tags = [] for tag in form.tags.data.lower().split(','): my_tags.append(Tag(name=tag)) post.tags=my_tags return post
def tag_pastor(): tag = Tag(name='pastor') tag.put() return tag
def tag_event(): tag = Tag(name='event') tag.put() return tag
def tag_computer(): tag = Tag(name='computer') tag.put() return tag
def find_by_tag_name(tag): posts = Post.query(Post.tags == Tag(name=tag), Post.post_status != 'draft').fetch() return render_template("site/post_list.html", posts=posts)