Fix missing client owner assignment
This commit is contained in:
parent
67ad1491e7
commit
cb340d2d2f
1 changed files with 8 additions and 0 deletions
|
@ -42,5 +42,13 @@ class ClientCreateView(TimeoutMixin, TitleMixin, CreateView):
|
|||
def get_object(self, queryset=None):
|
||||
return get_object_or_404(Client, owner=self.request.user, client_id=self.kwargs["pk"])
|
||||
|
||||
def form_valid(self, form):
|
||||
self.object = form.save(commit=False)
|
||||
|
||||
self.object.owner = self.request.user
|
||||
self.object.save()
|
||||
|
||||
return super().form_valid(form)
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse_lazy("frontend:client_edit", args=(self.object.client_id,))
|
Loading…
Reference in a new issue