Add a CSS class on required fields labels

This makes it possible to add a ' *' required notifier to labels without
needing a bunch of custom form code in templates.
This commit is contained in:
Sachi King 2017-04-24 23:09:21 +10:00
parent a162559a05
commit 2d4b29e6d9

View file

@ -62,6 +62,8 @@ class StripeWidgetProxy(widgets.Widget):
class CreditCardForm(forms.Form): class CreditCardForm(forms.Form):
required_css_class = 'label-required'
def _media(self): def _media(self):
js = ( js = (
'https://js.stripe.com/v2/', 'https://js.stripe.com/v2/',
@ -142,6 +144,8 @@ class CreditCardForm(forms.Form):
class StripeRefundForm(forms.Form): class StripeRefundForm(forms.Form):
required_css_class = 'label-required'
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
''' '''