X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/a7d1e3cd75cd56c3f9a5ddceb63196aad9d1db65..243ac5a586da9e5abb87698306794b6cc173ded1:/src/pz/models.py diff --git a/src/pz/models.py b/src/pz/models.py index 13afcba4d..4bd3673d6 100644 --- a/src/pz/models.py +++ b/src/pz/models.py @@ -1,7 +1,7 @@ import re from django.db import models from django.utils.timezone import now -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from .bank import parse_export_feedback, parse_payment_feedback @@ -44,7 +44,7 @@ class DirectDebit(models.Model): phone = models.CharField(_('phone'), max_length=255, blank=True) email = models.CharField(_('e-mail'), max_length=255, blank=True) iban = models.CharField(_('IBAN'), max_length=255, blank=True) - iban_valid = models.NullBooleanField(_('IBAN valid'), default=False) + iban_valid = models.BooleanField(_('IBAN valid'), default=False, null=True) is_consumer = models.BooleanField(_('is a consumer'), default=True) payment_id = models.CharField(_('payment identifier'), max_length=255, blank=True, unique=True) agree_fundraising = models.BooleanField(_('agree fundraising'), default=False) @@ -145,7 +145,7 @@ class BankExportFeedback(models.Model): self.save_export_feedback_items() def save_payment_items(self): - for payment_id, booking_date, is_dd, realised, reject_code in parse_payment_feedback(self.csv): + for payment_id, booking_date, is_dd, realised, reject_code in parse_payment_feedback(self.csv.open()): debit = DirectDebit.objects.get(payment_id = payment_id) b, created = self.payment_set.get_or_create( debit=debit, @@ -164,7 +164,7 @@ class BankExportFeedback(models.Model): b.save() def save_export_feedback_items(self): - for payment_id, status, comment in parse_export_feedback(self.csv): + for payment_id, status, comment in parse_export_feedback(self.csv.open()): debit = DirectDebit.objects.get(payment_id = payment_id) b, created = self.bankexportfeedbackline_set.get_or_create( debit=debit, @@ -179,7 +179,7 @@ class BankExportFeedback(models.Model): b.save() if status == 1 and not debit.bank_acceptance_date: debit.bank_acceptance_date = now().date() - debit.save() + debit.save() class BankExportFeedbackLine(models.Model):