Exemplo n.º 1
0
@never_cache
@login_required
def blacklist(request, blacklisted_podcast):
    user = request.user

    logger.info('Removing suggestion of "{podcast}" for "{user}"'.format(
        podcast=blacklisted_podcast, user=user))

    suggestion = PodcastSuggestion.objects.filter(suggested_to=user,
                                                  podcast=blacklisted_podcast)\
                                          .update(deleted=True)
    return HttpResponseRedirect(reverse('suggestions'))


@vary_on_cookie
@cache_control(private=True)
@login_required
def suggestions(request):
    user = request.user
    suggestions = Podcast.objects.filter(podcastsuggestion__suggested_to=user,
                                         podcastsuggestion__deleted=False)
    current_site = RequestSite(request)
    return render(request, 'suggestions.html', {
        'entries': suggestions,
        'url': current_site
    })


blacklist_slug = slug_decorator(blacklist)
blacklist_id = id_decorator(blacklist)
Exemplo n.º 2
0
    except PageNotAnInteger:
        # If page is not an integer, deliver first page.
        entries = paginator.page(1)
    except EmptyPage:
        # If page is out of range (e.g. 9999), deliver last page of results.
        entries = paginator.page(paginator.num_pages)

    return render(request, 'history.html', {
        'history': entries,
        'client': client,
        'page': page,
    })


@never_cache
@login_required
def podcast_history(request, podcast):
    """ shows the subscription history of the user """

    user = request.user
    history = HistoryEntry.objects.filter(user=request.user, podcast=podcast)

    return render(request, 'podcast-history.html', {
        'history': history,
        'podcast': podcast,
    })


history_podcast_slug = slug_decorator(podcast_history)
history_podcast_id = id_decorator(podcast_history)
Exemplo n.º 3
0
    except PageNotAnInteger:
        # If page is not an integer, deliver first page.
        entries = paginator.page(1)
    except EmptyPage:
        # If page is out of range (e.g. 9999), deliver last page of results.
        entries = paginator.page(paginator.num_pages)

    return render(request, 'history.html', {
        'history': entries,
        'client': client,
        'page': page,
    })


@never_cache
@login_required
def podcast_history(request, podcast):
    """ shows the subscription history of the user """

    user = request.user
    history = HistoryEntry.objects.filter(user=request.user, podcast=podcast)

    return render(request, 'podcast-history.html', {
        'history': history,
        'podcast': podcast,
    })


history_podcast_slug = slug_decorator(podcast_history)
history_podcast_id = id_decorator(podcast_history)
Exemplo n.º 4
0
@never_cache
@login_required
def blacklist(request, blacklisted_podcast):
    user = request.user

    logger.info('Removing suggestion of "{podcast}" for "{user}"'.format(
        podcast=blacklisted_podcast, user=user))

    suggestion = PodcastSuggestion.objects.filter(suggested_to=user,
                                                  podcast=blacklisted_podcast)\
                                          .update(deleted=True)
    return HttpResponseRedirect(reverse('suggestions'))


@vary_on_cookie
@cache_control(private=True)
@login_required
def suggestions(request):
    user = request.user
    suggestions = Podcast.objects.filter(podcastsuggestion__suggested_to=user,
                                         podcastsuggestion__deleted=False)
    current_site = RequestSite(request)
    return render(request, 'suggestions.html', {
        'entries': suggestions,
        'url': current_site
    })


blacklist_slug = slug_decorator(blacklist)
blacklist_id = id_decorator(blacklist)