Skip to content

Commit bb3612d

Browse files
committed
Added mail-optout to profile and update-profile
1 parent 9793a46 commit bb3612d

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

webapp/accounts/forms.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ class Meta:
229229
help_text=("Informatie over beschikbaarheid of andere bijzonderheden."
230230
"Zichtbaar voor andere VOKO leden.")
231231
)
232+
orderround_mail_optout = forms.BooleanField(
233+
label=("Ik wil geen e-mails ontvangen wanneer een bestelronde wordt geopend"),
234+
required=False,
235+
help_text=("Je krijgt geen e-mail meer wanneer een bestelronde wordt geopend")
236+
)
232237

233238
# TODO: Notes and e-mail address cannot be changed atm.
234239

@@ -249,6 +254,8 @@ def __init__(self, data=None, *args, **kwargs):
249254
self.instance.userprofile.car_type)
250255
self.fields['particularities'].initial = (
251256
self.instance.userprofile.particularities)
257+
self.fields['orderround_mail_optout'].initial = (
258+
self.instance.userprofile.orderround_mail_optout)
252259

253260
# If shares car, set more fields as required
254261
if data and data.get('shares_car', None) is not None:
@@ -287,6 +294,7 @@ def save(self, commit=True):
287294
self.cleaned_data['car_neighborhood'])
288295
userprofile.car_type = self.cleaned_data['car_type']
289296
userprofile.particularities = self.cleaned_data['particularities']
297+
userprofile.orderround_mail_optout = self.cleaned_data['orderround_mail_optout']
290298

291299
if commit:
292300
user.save()

webapp/templates/accounts/profile.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,22 @@ <h2 class="page-header">Profiel</h2>
103103
{{ user.userprofile.particularities|default:"-" }}
104104
</div>
105105
</div>
106+
<div class="row mt-3">
107+
<hr>
108+
</div>
109+
<div class="row">
110+
<div class="col">
111+
Ontvangt e-mail wanneer een bestelronde wordt geopend:
112+
</div>
113+
<div class="col">
114+
{% if user.userprofile.orderround_mail_optout %}
115+
Nee
116+
{% else %}
117+
Ja
118+
{% endif %}
119+
</div>
120+
</div>
121+
106122
</div>
107123
</div>
108124
<div class="d-flex justify-content-between">

0 commit comments

Comments
 (0)