X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/174cf7969627acdc1642f2eda012499b218abac8..d9c51b94bfe6b1cda1790d57a9108b83c6e1643b:/src/ajaxable/utils.py diff --git a/src/ajaxable/utils.py b/src/ajaxable/utils.py index 3a1c4558a..ddb36d8ba 100644 --- a/src/ajaxable/utils.py +++ b/src/ajaxable/utils.py @@ -1,5 +1,5 @@ -# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Wolne Lektury. See NOTICE for more information. # from functools import wraps import json @@ -9,7 +9,6 @@ from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidde from django.shortcuts import render from django.utils.encoding import force_str from django.utils.functional import Promise -from django.utils.translation import gettext_lazy as _ from django.views.decorators.vary import vary_on_headers from honeypot.decorators import verify_honeypot_value from wolnelektury.utils import is_ajax @@ -44,12 +43,6 @@ def require_login(request): return HttpResponseRedirect('/uzytkownicy/zaloguj') # next?=request.build_full_path()) -def placeholdized(form): - for field in form.fields.values(): - field.widget.attrs['placeholder'] = field.label + ('*' if field.required else '') - return form - - class AjaxableFormView: """Subclass this to create an ajaxable view for any form. @@ -57,10 +50,9 @@ class AjaxableFormView: """ form_class = None - placeholdize = False # override to customize form look template = "ajaxable/form.html" - submit = _('Send') + submit = 'Send' action = '' title = '' @@ -136,13 +128,10 @@ class AjaxableFormView: cd = self.context_description(request, obj) if cd: title += ": " + cd - if self.placeholdize: - form = placeholdized(form) context = { self.formname: form, "title": title, "honeypot": self.honeypot, - "placeholdize": self.placeholdize, "submit": self.submit, "action": self.action, "response_data": response_data,