diff --git a/users/models/invite.py b/users/models/invite.py index b84b7af..e5c11c3 100644 --- a/users/models/invite.py +++ b/users/models/invite.py @@ -27,10 +27,11 @@ class Invite(models.Model): admin_view = "{admin}{self.pk}/" @classmethod - def create_random(cls, email=None): + def create_random(cls, email=None, note=None): return cls.objects.create( token="".join( random.choice("abcdefghkmnpqrstuvwxyz23456789") for i in range(20) ), email=email, + note=note, ) diff --git a/users/views/admin/invites.py b/users/views/admin/invites.py index 338763a..ef76adb 100644 --- a/users/views/admin/invites.py +++ b/users/views/admin/invites.py @@ -43,8 +43,11 @@ class InviteCreate(FormView): ) def form_valid(self, form): - invite = Invite.create_random(email=form.cleaned_data.get("email") or None) - return redirect(invite.urls.admin) + invite = Invite.create_random( + email=form.cleaned_data.get("email") or None, + note=form.cleaned_data.get("notes"), + ) + return redirect(invite.urls.admin_view) @method_decorator(moderator_required, name="dispatch")