def tagged_post_feed(request, tag): return feeds.posts_feed( request, { 'title': "%s posts" % escape(tag.capitalize()), 'posts': Document.objects.public().filter(tags__name=tag.lower(), type='post') })
def author_post_feed(request, author_id): try: author = Profile.objects.enrolled().filter(pk=author_id)[0].user except IndexError: raise Http404 posts = author.documents_authored.public().filter(type="post") return feeds.posts_feed(request, { 'title': "Posts by %s" % unicode(author.profile), 'posts': posts, })
def org_post_feed(request, slug, filtered=True): org = get_object_or_404(Organization, slug=slug, public=True) docs = Document.objects.public().filter(author__organization=org, type="post").distinct() if filtered: docs = docs.filter(adult=False) return feeds.posts_feed(request, { 'title': "Recent posts from %s" % org.name, 'posts': docs, })
def campaign_feed(request, slug): campaign = get_object_or_404(Campaign, slug=slug, public=True) return feeds.posts_feed( request, { 'title': campaign.title, 'posts': Document.objects.safe().filter( in_reply_to_id=campaign.reply_code_id) })
def org_post_feed(request, slug, filtered=True): org = get_object_or_404(Organization, slug=slug, public=True) docs = Document.objects.public().filter( author__organization=org, type="post" ).distinct() if filtered: docs = docs.filter(adult=False) return feeds.posts_feed(request, { 'title': "Recent posts from %s" % org.name, 'posts': docs, })
def _choose_feed(request, context): if request.GET.get('full'): return feeds.full_posts_feed(request, context) return feeds.posts_feed(request, context)
def tagged_post_feed(request, tag): return feeds.posts_feed(request, { 'title': "%s posts" % escape(tag.capitalize()), 'posts': Document.objects.public().filter(tags__name=tag.lower(), type='post') })
def campaign_feed(request, slug): campaign = get_object_or_404(Campaign, slug=slug, public=True) return feeds.posts_feed(request, { 'title': campaign.title, 'posts': Document.objects.safe().filter(in_reply_to_id=campaign.reply_code_id) })
def all_posts_feed(request): return feeds.posts_feed(request, { 'title': "Recent posts from all authors", 'posts': Document.objects.safe().filter(type="post") })
def all_posts_feed(request): return feeds.posts_feed( request, { 'title': "Recent posts from all authors", 'posts': Document.objects.safe().filter(type="post") })