[Answer]-Django fiter query from relational table

1👍

Since you set a ForeignKey to the user, the user model will have a jsdetails_set which is a RelatedManager. You could try in your template this:

{{ com.user.jsdetails_set.all.0.profilepic.url }}

This will try and return the first jsdetails instance. Don’t know for sure if it fails silently when trying to access the 0 index if it’s not set.

Leave a comment