[Fixed]-Django – How to filter dropdown based on user id?

1👍

You can do it in view itself using

form = PredefinedMessageDetailForm(request.POST or None, instance=predefined_message_detail) 
form.fields["predefined_message_detail"].queryset= PredefinedMessage.objects.filter(user=request.user)

But filtering happens based on request.user so it should be logged in.Consider that also. Hope this helps

Leave a comment