pass various variables to CreateComputerForm
This commit is contained in:
parent
473cbf8919
commit
fabdfe4c9b
|
@ -88,6 +88,15 @@ class ComputerCreateFromCustomerView(LoginRequiredMixin, CreateView):
|
|||
def get_success_url(self):
|
||||
return reverse('computer_update', args=(self.object.pk,))
|
||||
|
||||
def get_form_kwargs(self):
|
||||
"""
|
||||
Pass the URL variables and the request user to the form.
|
||||
"""
|
||||
kwargs = super(ComputerCreateFromCustomerView, self).get_form_kwargs()
|
||||
kwargs.update(self.kwargs)
|
||||
kwargs.update({'user': self.request.user})
|
||||
return kwargs
|
||||
|
||||
|
||||
class ComputerUpdateView(LoginRequiredMixin, UpdateView):
|
||||
model = Computer
|
||||
|
|
Loading…
Reference in New Issue