From 51752ff5a54adfaa2e9e8c8f7325067cc6577cf5 Mon Sep 17 00:00:00 2001 From: Hugo LEVY-FALK Date: Wed, 11 Jul 2018 15:15:58 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Fix=20de=20la=20migration=20des=20donn?= =?UTF-8?q?=C3=A9es.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cotisations/migrations/0032_chequepayment_comnpaypayment.py | 5 ++--- cotisations/views.py | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cotisations/migrations/0032_chequepayment_comnpaypayment.py b/cotisations/migrations/0032_chequepayment_comnpaypayment.py index 81fada42..2277efb4 100644 --- a/cotisations/migrations/0032_chequepayment_comnpaypayment.py +++ b/cotisations/migrations/0032_chequepayment_comnpaypayment.py @@ -27,7 +27,6 @@ def add_comnpay(apps, schema_editor): ) comnpay = ComnpayPayment() comnpay.payment_user = options.payment_id - comnpay.payment_pass = options.payment_pass comnpay.payment = payment comnpay.save() payment.moyen = "ComnPay" @@ -61,6 +60,6 @@ class Migration(migrations.Migration): ], bases=(cotisations.payment_methods.mixins.PaymentMethodMixin, models.Model), ), - # migrations.RunPython(add_comnpay), - # migrations.RunPython(add_cheque), + migrations.RunPython(add_comnpay), + migrations.RunPython(add_cheque), ] diff --git a/cotisations/views.py b/cotisations/views.py index 13c8b461..40e10e36 100644 --- a/cotisations/views.py +++ b/cotisations/views.py @@ -421,7 +421,8 @@ def add_paiement(request): return form({ 'factureform': payment, 'payment_method': payment_method, - 'action_name': _("Add") + 'action_name': _("Add"), + 'title': _("New payment method") }, 'cotisations/facture.html', request) From f7e414f6d5659e2d89dbb583dcc12ec52b2d5abc Mon Sep 17 00:00:00 2001 From: Hugo LEVY-FALK Date: Wed, 11 Jul 2018 17:25:53 +0200 Subject: [PATCH 2/2] Support de postgreSQL pour AESENCryptedField --- re2o/aes_field.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/re2o/aes_field.py b/re2o/aes_field.py index 5708eeef..2720f5af 100644 --- a/re2o/aes_field.py +++ b/re2o/aes_field.py @@ -72,9 +72,10 @@ class AESEncryptedFormField(forms.CharField): class AESEncryptedField(models.CharField): """ A Field that can be used in forms for adding the support of AES ecnrypted fields """ + def save_form_data(self, instance, data): - setattr(instance, self.name, - binascii.b2a_base64(encrypt(settings.AES_KEY, data))) + setattr(instance, self.name, binascii.b2a_base64( + encrypt(settings.AES_KEY, data)).decode('utf-8')) def to_python(self, value): if value is None: @@ -83,18 +84,16 @@ class AESEncryptedField(models.CharField): return decrypt(settings.AES_KEY, binascii.a2b_base64(value)).decode('utf-8') except Exception as e: - v = decrypt(settings.AES_KEY, binascii.a2b_base64(value)) - raise ValueError(v) + raise ValueError(value) def from_db_value(self, value, *args, **kwargs): if value is None: return value try: return decrypt(settings.AES_KEY, - binascii.a2b_base64(value)).decode('utf-8') + binascii.a2b_base64(value)).decode('utf-8') except Exception as e: - v = decrypt(settings.AES_KEY, binascii.a2b_base64(value)) - raise ValueError(v) + raise ValueError(value) def get_prep_value(self, value): if value is None: @@ -102,7 +101,7 @@ class AESEncryptedField(models.CharField): return binascii.b2a_base64(encrypt( settings.AES_KEY, value - )) + )).decode('utf-8') def formfield(self, **kwargs): defaults = {'form_class': AESEncryptedFormField}