1👍
✅
You should first get user by id then get model details using that retrieved user.
views.py
@login_required
def data_form(request):
if request.user.is_staff == True:
if request.method == 'POST':
form = DataRequestForm(request.POST)
if form.is_valid():
user = request.POST["user"]
print("Form is Valid")
print(user)
# getting user data by id.
get_user = get_object_or_404(User, id=user)
get_another_model_data = SecondModel.objects.filter(user=get_user)
# perform or save the data here
👤Lars
Source:stackexchange.com