Exemple #1
0
def blacklist(request, blacklisted_podcast):
    user = request.user

    suggestion = suggestions_for_user(user)

    @repeat_on_conflict(['suggestion'])
    def _update(suggestion, podcast_id):
        suggestion.blacklist.append(podcast_id)
        suggestion.save()

    _update(suggestion=suggestion, podcast_id=blacklisted_podcast.get_id())
    update_suggestions.delay(user)

    return HttpResponseRedirect(reverse('suggestions'))
Exemple #2
0
def update_suggestions_on_subscription(sender, **kwargs):
    """ update a user's suggestions after one of his subscriptions change """
    user = kwargs['user']
    update_suggestions.delay(user)