Bank transfer: Allow to set custom public name

This commit is contained in:
Raphael Michel
2019-01-12 16:06:21 +01:00
parent 66164d8202
commit 228ab15900

View File

@@ -8,6 +8,7 @@ from django.http import HttpRequest
from django.template.loader import get_template from django.template.loader import get_template
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from i18nfield.fields import I18nFormField, I18nTextarea from i18nfield.fields import I18nFormField, I18nTextarea
from i18nfield.forms import I18nTextInput
from i18nfield.strings import LazyI18nString from i18nfield.strings import LazyI18nString
from localflavor.generic.forms import BICFormField, IBANFormField from localflavor.generic.forms import BICFormField, IBANFormField
@@ -88,9 +89,18 @@ class BankTransfer(BasePaymentProvider):
), ),
}}, }},
required=False required=False
)),
('public_name', I18nFormField(
label=_('Payment method name'),
widget=I18nTextInput,
required=False
)) ))
]) ])
@property
def public_name(self):
return str(self.settings.get('public_name', as_type=LazyI18nString)) or self.verbose_name
@property @property
def settings_form_fields(self): def settings_form_fields(self):
d = OrderedDict( d = OrderedDict(