Skip to content

Commit

Permalink
add send registration email to create user form
Browse files Browse the repository at this point in the history
  • Loading branch information
struan committed Jun 19, 2024
1 parent f1e0a5c commit 553e8b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions crowdsourcer/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,10 @@ class Meta:
fields = ["response_type", "authority"]


class CreateMarkerForm(MarkerForm):
send_reset = BooleanField(label="Send registration email")


MarkerFormset = inlineformset_factory(User, Marker, form=MarkerForm, can_delete=False)


Expand Down
7 changes: 5 additions & 2 deletions crowdsourcer/views/volunteers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from django.views.generic import FormView, ListView

from crowdsourcer.forms import (
MarkerForm,
CreateMarkerForm,
MarkerFormset,
ResetEmailForm,
UserForm,
Expand Down Expand Up @@ -64,7 +64,7 @@ def get_success_url(self):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)

marker_form = MarkerForm(
marker_form = CreateMarkerForm(
**{**self.get_form_kwargs(), "session": self.request.current_session}
)

Expand All @@ -83,6 +83,9 @@ def form_valid(self, form):

m.marking_session.add(self.request.current_session)

if marker_form.cleaned_data["send_reset"] is True:
send_registration_email(u, self.request.get_host())

return super().form_valid(form)


Expand Down

0 comments on commit 553e8b3

Please sign in to comment.