feat: pass current user to SuffixUpdateView forms
Enhances the get_form_kwargs method in SuffixUpdateView to include the current user in the form parameters. This allows for user-specific form processing and validation, ensuring forms can access and utilize the requesting user's details.
This commit is contained in:
parent
af3315b3f1
commit
564eecf83e
1 changed files with 5 additions and 0 deletions
|
@ -179,6 +179,11 @@ class SuffixUpdateView(LoginRequiredMixin, CustomPermissionMixin, UpdateView):
|
|||
template_name = "resolver/suffix_form.html"
|
||||
success_url = reverse_lazy("suffix_list")
|
||||
|
||||
def get_form_kwargs(self):
|
||||
kwargs = super().get_form_kwargs()
|
||||
kwargs["user"] = self.request.user
|
||||
return kwargs
|
||||
|
||||
|
||||
class SuffixDeleteView(LoginRequiredMixin, CustomPermissionMixin, DeleteView):
|
||||
model = Suffix
|
||||
|
|
Loading…
Reference in a new issue