1
0
mirror of https://gitlab.crans.org/bde/nk20-scripts synced 2025-07-01 02:21:15 +02:00

Prevent also club owners when the note balance is negative

This commit is contained in:
Yohann D'ANELLO
2020-08-31 16:13:23 +02:00
parent 4179cad611
commit 2b1c05ff98
2 changed files with 7 additions and 5 deletions

View File

@ -5,10 +5,11 @@ from datetime import date
from django.core.mail import send_mail
from django.core.management import BaseCommand
from django.db.models import Q
from django.template.loader import render_to_string
from django.utils.translation import activate
from note.models import NoteUser
from note.models import NoteUser, Note
class Command(BaseCommand):
@ -20,9 +21,10 @@ class Command(BaseCommand):
def handle(self, *args, **options):
activate('fr')
notes = NoteUser.objects.filter(
notes = Note.objects.filter(
Q(noteuser__user__memberships__date_end__gte=date.today()) | Q(noteclub__isnull=False),
balance__lte=-options["negative_amount"],
user__memberships__date_end__gte=date.today(),
is_active=True,
).order_by('balance').distinct().all()
if options["spam"]: