Skip to content

Commit 403ed4f

Browse files
committed
Do not semd reminder mail to users who opted out
1 parent e8b9595 commit 403ed4f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

webapp/ordering/models.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from datetime import datetime
66
from decimal import Decimal, ROUND_UP, ROUND_DOWN
77
from django.db import models, transaction
8+
from django.db.models import Q
89
from django_extensions.db.models import TimeStampedModel
910
from django.core.exceptions import ValidationError
1011
from accounts.models import Address, VokoUser
@@ -338,7 +339,10 @@ def _users_without_orders_filter(voko_user):
338339

339340
return list(
340341
filter(
341-
_users_without_orders_filter, VokoUser.objects.filter(is_active=True)
342+
_users_without_orders_filter,
343+
VokoUser.objects.filter(Q(is_active=True)
344+
(Q(userprofile__isnull=True)
345+
| Q(userprofile__orderround_mail_optout=False)))
342346
)
343347
)
344348

0 commit comments

Comments
 (0)