mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-21 09:58:23 +02:00
Fix mails when the user or the club has a negative balance
This commit is contained in:
@ -4,7 +4,9 @@
|
||||
import unicodedata
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.global_settings import DEFAULT_FROM_EMAIL
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.mail import send_mail
|
||||
from django.core.validators import RegexValidator
|
||||
from django.db import models
|
||||
from django.template.loader import render_to_string
|
||||
@ -193,7 +195,6 @@ class NoteClub(Note):
|
||||
super().save(*args, **kwargs)
|
||||
if old_note.balance >= 0:
|
||||
# Passage en négatif
|
||||
super().save(*args, **kwargs)
|
||||
self.last_negative = timezone.now()
|
||||
self._force_save = True
|
||||
self.save(*args, **kwargs)
|
||||
@ -204,8 +205,8 @@ class NoteClub(Note):
|
||||
def send_mail_negative_balance(self):
|
||||
plain_text = render_to_string("note/mails/negative_balance.txt", dict(note=self))
|
||||
html = render_to_string("note/mails/negative_balance.html", dict(note=self))
|
||||
self.user.email_user("[Note Kfet] Passage en négatif (club {})"
|
||||
.format(self.club.name), plain_text, html_message=html)
|
||||
send_mail("[Note Kfet] Passage en négatif (club {})".format(self.club.name), plain_text, DEFAULT_FROM_EMAIL,
|
||||
[self.club.email], html_message=html)
|
||||
|
||||
|
||||
class NoteSpecial(Note):
|
||||
|
Reference in New Issue
Block a user