mirror of https://gitlab.crans.org/bde/nk20
Fix linting
This commit is contained in:
parent
dbc6fbbf71
commit
5ed0560953
|
@ -5,7 +5,7 @@ import unicodedata
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.conf.global_settings import DEFAULT_FROM_EMAIL
|
from django.conf.global_settings import DEFAULT_FROM_EMAIL
|
||||||
from django.core.exceptions import ValidationError, PermissionDenied
|
from django.core.exceptions import ValidationError
|
||||||
from django.core.mail import send_mail
|
from django.core.mail import send_mail
|
||||||
from django.core.validators import RegexValidator
|
from django.core.validators import RegexValidator
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.db.models import F
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.contrib.sessions.models import Session
|
from django.contrib.sessions.models import Session
|
||||||
from note_kfet.middlewares import get_current_session
|
from note_kfet.middlewares import get_current_session
|
||||||
|
|
||||||
|
|
|
@ -307,10 +307,10 @@ class SogeCredit(models.Model):
|
||||||
if self.valid:
|
if self.valid:
|
||||||
self.credit_transaction.valid = False
|
self.credit_transaction.valid = False
|
||||||
self.credit_transaction.save()
|
self.credit_transaction.save()
|
||||||
for transaction in self.transactions.all():
|
for tr in self.transactions.all():
|
||||||
transaction.valid = False
|
tr.valid = False
|
||||||
transaction._force_save = True
|
tr._force_save = True
|
||||||
transaction.save()
|
tr.save()
|
||||||
|
|
||||||
def validate(self, force=False):
|
def validate(self, force=False):
|
||||||
if self.valid and not force:
|
if self.valid and not force:
|
||||||
|
@ -325,11 +325,11 @@ class SogeCredit(models.Model):
|
||||||
self.credit_transaction.save()
|
self.credit_transaction.save()
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
for transaction in self.transactions.all():
|
for tr in self.transactions.all():
|
||||||
transaction.valid = True
|
tr.valid = True
|
||||||
transaction._force_save = True
|
tr._force_save = True
|
||||||
transaction.created_at = timezone.now()
|
tr.created_at = timezone.now()
|
||||||
transaction.save()
|
tr.save()
|
||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
|
@ -364,11 +364,11 @@ class SogeCredit(models.Model):
|
||||||
"Please ask her/him to credit the note before invalidating this credit."))
|
"Please ask her/him to credit the note before invalidating this credit."))
|
||||||
|
|
||||||
self.invalidate()
|
self.invalidate()
|
||||||
for transaction in self.transactions.all():
|
for tr in self.transactions.all():
|
||||||
transaction._force_save = True
|
tr._force_save = True
|
||||||
transaction.valid = True
|
tr.valid = True
|
||||||
transaction.created_at = timezone.now()
|
tr.created_at = timezone.now()
|
||||||
transaction.save()
|
tr.save()
|
||||||
self.credit_transaction.valid = False
|
self.credit_transaction.valid = False
|
||||||
self.credit_transaction.reason += " (invalide)"
|
self.credit_transaction.reason += " (invalide)"
|
||||||
self.credit_transaction.save()
|
self.credit_transaction.save()
|
||||||
|
|
Loading…
Reference in New Issue