Ejemplo n.º 1
0
def save_custom_homepage(request):
    """Save custom homepage."""
    form = forms.UserCustomHomepageForm(request.POST, instance=request.user.profile)

    if not form.is_valid():
        error = escape("\n".join(form.errors["custom_homepage"]))
        return HttpResponseBadRequest(error)

    form.save()

    return HttpResponse("ok")
Ejemplo n.º 2
0
def save_custom_homepage(request):
    """Save custom homepage."""
    form = forms.UserCustomHomepageForm(request.POST,
                                        instance=request.user.profile)

    if not form.is_valid():
        return HttpResponseBadRequest(u'\n'.join(
            form.errors['custom_homepage']))

    form.save()

    return HttpResponse('ok')