Use get parameters as initial form values (#3)

This commit is contained in:
Edgar P. Burkhart 2022-12-31 09:59:47 +01:00
parent 34d5ce647c
commit 4e6dd25c99
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227

View file

@ -41,7 +41,10 @@ class UserMixin(LoginRequiredMixin):
class UserFormMixin: class UserFormMixin:
def get_form_kwargs(self): def get_form_kwargs(self):
return super().get_form_kwargs() | {"user": self.request.user} return super().get_form_kwargs() | {
"user": self.request.user,
"initial": self.request.GET,
}
class NummiCreateView(UserMixin, UserFormMixin, CreateView): class NummiCreateView(UserMixin, UserFormMixin, CreateView):