コード例 #1
0
def activate(request):
    form = ActivateForm(request.POST)
    if form.is_valid():
        support = SupportStatus(**form.cleaned_data)
        try:
            support.refresh()
            support.save()
            messages.success(request, _('Activation completed.'))
        except Exception as error:
            report_error(error, request)
            messages.error(
                request,
                _('The activation failed. Please check your activation token.')
            )
    else:
        show_form_errors(request, form)
    return redirect('manage')
コード例 #2
0
ファイル: views.py プロジェクト: lcsouzamenezes/weblate
def activate(request):
    form = ActivateForm(request.POST)
    if form.is_valid():
        support = SupportStatus(**form.cleaned_data)
        try:
            support.refresh()
            support.save()
            messages.success(request, _("Activation completed."))
        except Exception:
            report_error()
            messages.error(
                request,
                _("Could not activate your installation. "
                  "Please ensure your activation token is correct."),
            )
    else:
        show_form_errors(request, form)
    return redirect("manage")