1
Logic is:
Select all images from Images object where user has FK:
query = UserImages.objects.filter(user=1).all()
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)
- How to avoid a trip to the database in this Test case
- Django, I can't return httpresponse data with ajax on admin change_list view
- Django POST dict empty, use simple html form
- NoReverseMatch at /blog/create/
- Compare datetime field with date in django orm
Source:stackexchange.com