Example #1
0
def flatpage(request, url):
    """
    Flat page view.

    Models: `flatpages.flatpages`
    Templates: Uses the template defined by the ``template_name`` field,
        or `flatpages/default` if template_name is not defined.
    Context:
        flatpage
            `flatpages.flatpages` object
    """
    if not url.startswith('/'):
        url = "/" + url
    f = get_object_or_404(flatpages, url__exact=url, sites__id__exact=SITE_ID)
    # If registration is required for accessing this page, and the user isn't
    # logged in, redirect to the login page.
    if f.registration_required and request.user.is_anonymous():
        from django.views.auth.login import redirect_to_login
        return redirect_to_login(request.path)
    if f.template_name:
        t = template_loader.select_template((f.template_name, DEFAULT_TEMPLATE))
    else:
        t = template_loader.get_template(DEFAULT_TEMPLATE)
    c = DjangoContext(request, {
        'flatpage': f,
    })
    return HttpResponse(t.render(c))
Example #2
0
def pause(request, t_id):
    torrent = get_object_or_404(torrents, pk=t_id)
    torrent.status = 'pa'
    torrent.save()

    try:
        fetcher = fetchers.get_object(pk=torrent.id)
        fetcher.kill_process()
    except fetchers.FetcherDoesNotExist:
        pass

    return HttpResponseRedirect('..')
Example #3
0
def torrent(request, t_id):
    torrent = get_object_or_404(torrents, pk=t_id)
    try:
        fetcher = fetchers.get_object(pk=torrent.id)
    except fetchers.FetcherDoesNotExist:
        fetcher = None
    msgs = messages.get_list(order_by=['-logged'], limit=30, torrent__id__exact=torrent.id)
    return render_to_response('aurora/torrent', {
            'torrent': torrent,
            'fetcher': fetcher,
            'aurora_messages': msgs,
        })
Example #4
0
def feed_index(request, feed_id):
    feed = get_object_or_404(feeds, pk=int(feed_id))
    posts = feed.get_latest_posts()
    
    return render_to_response('aggemam/feed', locals())
Example #5
0
def resume(request, t_id):
    torrent = get_object_or_404(torrents, pk=t_id)
    torrent.status = 'wk'
    torrent.save()
    return HttpResponseRedirect('..')