django 1.11: handle form creation through get_context_data (#21489)
In django 1.11 form initialisation might not happen until get_context_data is called, so we can't expect self.ou to be populated until then. https://code.djangoproject.com/ticket/24643
This commit is contained in:
parent
716c9e29a7
commit
e696f983b2
|
@ -132,9 +132,10 @@ class UserAddView(BaseAddView):
|
|||
return reverse('a2-manager-user-detail', kwargs={'pk': self.object.pk})
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs['cancel_url'] = '../..'
|
||||
kwargs['ou'] = self.ou
|
||||
return super(UserAddView, self).get_context_data(**kwargs)
|
||||
context = super(UserAddView, self).get_context_data(**kwargs)
|
||||
context['cancel_url'] = '../..'
|
||||
context['ou'] = self.ou
|
||||
return context
|
||||
|
||||
def form_valid(self, form):
|
||||
response = super(UserAddView, self).form_valid(form)
|
||||
|
|
Loading…
Reference in New Issue