예제 #1
0
def links_from_channel(request, channel_slug):
    return render_to_response(
        "links/link_list.html",
        context_builder(request, links_from="channel",
            instance=get_object_or_404(Channel, slug=channel_slug)),
        context_instance=RequestContext(request)
    )
예제 #2
0
파일: views.py 프로젝트: ogomogo/linkfloyd
def links_from_channel(request, channel_slug):
    channel = get_object_or_404(Channel, slug=channel_slug)
    context = context_builder(request, links_from="channel", instance=channel)
    context.update({
        "sibling_channels": Channel.objects.filter(
            parent=channel.parent) if channel.parent else None,
        "child_channels": Channel.objects.filter(parent=channel)})
    return render_to_response(
        "links/link_list.html", context,
        context_instance=RequestContext(request)
    )
예제 #3
0
파일: views.py 프로젝트: ogomogo/linkfloyd
def index(request):
    if request.user.is_authenticated():
        if not Subscription.objects.filter(user=request.user):
            messages.add_message(request, messages.WARNING,
                _("Subscribe channels that you are interested in"))
            return HttpResponseRedirect(reverse("browse_channels"))
    return render_to_response(
        "links/link_list.html",
        context_builder(request, links_from="subscriptions"),
        context_instance=RequestContext(request)
    )
예제 #4
0
파일: views.py 프로젝트: ogomogo/linkfloyd
def links_from_user(request, username):

    # Here were monkeypatching user instance to make it work with django_ogp

    user = get_object_or_404(User, username=username)
    description = UserPreferences.objects.get(user=user).description

    user.ogp_enabled = True
    user.ogp_title = _("%s on Linkfloyd" % user.username)
    user.ogp_description = description or ""

    # Prepare context
    context = context_builder(request, links_from="user", instance=user)
    context.update({"description": description})

    return render_to_response(
        "links/link_list.html", context,
        context_instance=RequestContext(request))
예제 #5
0
파일: views.py 프로젝트: ogomogo/linkfloyd
def links_from_all_channels(request):
    context = context_builder(request)
    return render_to_response(
        "links/link_list.html", context,
        context_instance=RequestContext(request))