From 9518f627b82c6bd364724c21dc3e5c6518c9d251 Mon Sep 17 00:00:00 2001 From: anthony sottile <103459774+asottile-sentry@users.noreply.github.com> Date: Thu, 25 Jul 2024 09:56:04 -0400 Subject: [PATCH] ref: match base class signature of render(...) for widgets (#74896) --- src/sentry/web/forms/fields.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/sentry/web/forms/fields.py b/src/sentry/web/forms/fields.py index ca1e5de63555f9..f813d6a1960e94 100644 --- a/src/sentry/web/forms/fields.py +++ b/src/sentry/web/forms/fields.py @@ -30,14 +30,13 @@ def validate(self, value): class UserField(CharField): class widget(TextInput): - def render(self, name, value, attrs=None): + def render(self, name, value, attrs=None, renderer=None): if not attrs: attrs = {} - if "placeholder" not in attrs: - attrs["placeholder"] = "username" + attrs.setdefault("placeholder", "username") if isinstance(value, int): value = User.objects.get(id=value).username - return super().render(name, value, attrs) + return super().render(name, value, attrs=attrs, renderer=renderer) def clean(self, value): value = super().clean(value) @@ -50,7 +49,7 @@ def clean(self, value): class ReadOnlyTextWidget(Widget): - def render(self, name, value, attrs): + def render(self, name, value, attrs=None, renderer=None): final_attrs = self.build_attrs(attrs) if not value: value = mark_safe("%s" % _("Not set"))