Exemple #1
0
def watch_locale(request):
    """Watch/unwatch a locale."""
    locale = request.LANGUAGE_CODE
    if request.POST.get("watch") == "yes":
        NewPostInLocaleEvent.notify(request.user, locale=locale)
        NewThreadInLocaleEvent.notify(request.user, locale=locale)
    else:
        NewPostInLocaleEvent.stop_notifying(request.user, locale=locale)
        NewThreadInLocaleEvent.stop_notifying(request.user, locale=locale)

    # If there is no next url, send the user to the home page.
    return HttpResponseRedirect(get_next_url(request) or reverse("home"))
Exemple #2
0
def watch_locale(request):
    """Watch/unwatch a locale."""
    locale = request.LANGUAGE_CODE
    if request.POST.get('watch') == 'yes':
        NewPostInLocaleEvent.notify(request.user, locale=locale)
        NewThreadInLocaleEvent.notify(request.user, locale=locale)
        statsd.incr('kbforums.watches.locale')
    else:
        NewPostInLocaleEvent.stop_notifying(request.user, locale=locale)
        NewThreadInLocaleEvent.stop_notifying(request.user, locale=locale)

    # If there is no next url, send the user to the home page.
    return HttpResponseRedirect(get_next_url(request) or reverse('home'))
Exemple #3
0
def watch_locale(request):
    """Watch/unwatch a locale."""
    locale = request.LANGUAGE_CODE
    if request.POST.get('watch') == 'yes':
        NewPostInLocaleEvent.notify(request.user, locale=locale)
        NewThreadInLocaleEvent.notify(request.user, locale=locale)
        statsd.incr('kbforums.watches.locale')
    else:
        NewPostInLocaleEvent.stop_notifying(request.user, locale=locale)
        NewThreadInLocaleEvent.stop_notifying(request.user, locale=locale)

    # If there is no next url, send the user to the home page.
    return HttpResponseRedirect(get_next_url(request) or reverse('home'))