I am working on a hard django project and I am stuck again. In my implementation of ModelForm, I have this form. So I wanna filter the queryset in the assign
field so if I do this assign.objects.filter(user_id=1)
it is gonna show every user this queryset but I wanna put the request user in this queryset. How can I access the current request user?
class SomeModelForm(forms.ModelForm):
assign = forms.ModelMultipleChoiceField(
widget=forms.CheckboxSelectMultiple,
queryset=Assign.objects.all(),
)
class Meta:
model = SomeModel
fields = '__all__'