I have two models
class Post(models.Model):
...
class PostImage(models.Model):
post = models.ForeignKey(Post)
...
In a ListView I need to query a post and one image for it, so I end up writing a raw query. What I hit now is that the url fields are simple path strings which Django tries to load from my app, instead of the MEDIA_URL which otherwise works if the object is loaded via the ORM.
Is there a way to convert that path to the URL in the template using the Django syntax ?
{{ post.image.url }}