Exemple #1
0
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')
        })
Exemple #2
0
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,
    })
Exemple #3
0
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,
    })
Exemple #4
0
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,
    })
Exemple #5
0
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)
        })
Exemple #6
0
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,
    })
Exemple #7
0
def _choose_feed(request, context):
    if request.GET.get('full'):
        return feeds.full_posts_feed(request, context)
    return feeds.posts_feed(request, context)
Exemple #8
0
def _choose_feed(request, context):
    if request.GET.get('full'):
        return feeds.full_posts_feed(request, context)
    return feeds.posts_feed(request, context)
Exemple #9
0
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')
    })
Exemple #10
0
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)
    })
Exemple #11
0
def all_posts_feed(request):
    return feeds.posts_feed(request, {
        'title': "Recent posts from all authors",
        'posts': Document.objects.safe().filter(type="post")
    })
Exemple #12
0
def all_posts_feed(request):
    return feeds.posts_feed(
        request, {
            'title': "Recent posts from all authors",
            'posts': Document.objects.safe().filter(type="post")
        })