Answer the question
In order to leave comments, you need to log in
How to pass request.user to UpdateView?
How to pass request.user to the form that has this code:
def __init__(self, user, *args, **kwargs):
super(Form, self).__init__(*args, **kwargs)
self.fields['category'].queryset = Category.objects.all().filter(user=user)
class UpdateView(UpdateView):
model = Model
success_url = '/account/model'
template_name = 'main/model.html'
form_class = Form
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question