X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/98e12313596c58738fc7e3eeaccfde202b91ef2a..f2c1566914d2ee615546134b9e080fc32c1a1094:/apps/suggest/views.py?ds=sidebyside diff --git a/apps/suggest/views.py b/apps/suggest/views.py index cd733a840..ac45cea34 100644 --- a/apps/suggest/views.py +++ b/apps/suggest/views.py @@ -11,7 +11,7 @@ from suggest import forms from suggest.models import Suggestion # FIXME - shouldn't be in catalogue -from catalogue.views import LazyEncoder +from catalogue.views import LazyEncoder #@require_POST @@ -19,12 +19,10 @@ from catalogue.views import LazyEncoder def report(request): suggest_form = forms.SuggestForm(request.POST) if suggest_form.is_valid(): - author = suggest_form.cleaned_data['author'] - email = suggest_form.cleaned_data['email'] - title = suggest_form.cleaned_data['title'] + contact = suggest_form.cleaned_data['contact'] description = suggest_form.cleaned_data['description'] - suggestion = Suggestion(author=author, email=email, title=title, + suggestion = Suggestion(contact=contact, description=description, ip=request.META['REMOTE_ADDR']) if request.user.is_authenticated(): suggestion.user = request.user @@ -33,5 +31,4 @@ def report(request): response_data = {'success': True, 'message': _('Report was sent successfully.')} else: response_data = {'success': False, 'errors': suggest_form.errors} - print LazyEncoder(ensure_ascii=False).encode(response_data) return HttpResponse(LazyEncoder(ensure_ascii=False).encode(response_data))