- suggestion = Suggestion(author=author, email=email, title=title,
- description=description, ip=request.META['REMOTE_ADDR'])
- if request.user.is_authenticated():
- suggestion.user = request.user
- suggestion.save()
-
- 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))
+class SuggestionFormView(AjaxableFormView):
+ form_class = forms.SuggestForm
+ placeholdize = True
+ title = _('Report a bug or suggestion')
+ submit = _('Send report')
+ success_message = _('Report was sent successfully.')