[Fixed]-Cannot get models thats referencing another model aas foriegn key

1👍

Logic is:
Select all images from Images object where user has FK:

query = UserImages.objects.filter(user=1).all()
👤Marin

0👍

There are multiple ways to get this,you can try this also

userObj=User.objects.get(pk=1)
userImages = UserImages.objects.filter(user=userObj)
Images=[]
for userImage in userImages:
    Images.append(userImage.image)

Leave a comment