lingo: PEP8ize TipiPaymentFormCell (#35008)

This commit is contained in:
Benjamin Dauvergne 2019-07-23 12:06:12 +02:00
parent f93aeb232a
commit 68b376d3f3
1 changed files with 10 additions and 5 deletions

View File

@ -722,12 +722,14 @@ TIPI_CONTROL_PROCOTOLS = (
('rolmre', _('ROLMRE')),
)
@register_cell_class
class TipiPaymentFormCell(CellBase):
title = models.CharField(_('Title'), max_length=150, blank=True)
url = models.URLField(_('TIPI payment service URL'), default='https://www.tipi.budget.gouv.fr/tpa/paiement.web')
regies = models.CharField(_('Regies'), help_text=_('separated by commas'), max_length=256)
control_protocol = models.CharField(_('Control protocol'), max_length=8, choices=TIPI_CONTROL_PROCOTOLS, default='pesv2')
control_protocol = models.CharField(_('Control protocol'), max_length=8, choices=TIPI_CONTROL_PROCOTOLS,
default='pesv2')
exer = models.CharField('Exer', max_length=4, blank=True, help_text=_('Default value to be used in form'))
idpce = models.CharField('IDPCE', max_length=8, blank=True, help_text=_('Default value to be used in form'))
idligne = models.CharField('IDLIGNE', max_length=6, blank=True, help_text=_('Default value to be used in form'))
@ -767,10 +769,13 @@ class TipiPaymentFormCell(CellBase):
# special pattern for rolrec
if field == 'rolrec':
field_pattern = '[A-Z0-9]+'
reference_fields.append({'name': field, 'length': form_fields[field].max_length,
'placeholder': '0'*form_fields[field].max_length,
'pattern': field_pattern,
'protocol': definition['protocol']})
reference_fields.append({
'name': field,
'length': form_fields[field].max_length,
'placeholder': '0' * form_fields[field].max_length,
'pattern': field_pattern,
'protocol': definition['protocol']
})
context['title'] = self.title
context['url'] = self.url
context['mode'] = 'T' if self.test_mode else 'M'