From 3c2665c392671db9e76e1d547e03a2640da5ded8 Mon Sep 17 00:00:00 2001 From: SwoopDoable <swoop-doable.0v@icloud.com> Date: Mon, 12 Aug 2024 17:16:46 +0200 Subject: [PATCH] Facilitate first and last name profile creation --- scipost_django/profiles/views.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scipost_django/profiles/views.py b/scipost_django/profiles/views.py index 8c3f984e8..d9430bfd9 100644 --- a/scipost_django/profiles/views.py +++ b/scipost_django/profiles/views.py @@ -124,7 +124,14 @@ class ProfileCreateView(PermissionsMixin, CreateView): initial = super().get_initial() from_type = self.kwargs.get("from_type", None) pk = self.kwargs.get("pk", None) - + + # Build initial data from GET parameters of the name. + first_name = self.request.GET.get("first_name", None) + last_name = self.request.GET.get("last_name", None) + + if first_name: initial.update({"first_name": first_name}) + if last_name: initial.update({"last_name": last_name}) + if pk and from_type: pk = int(pk) if from_type == "contributor": -- GitLab