I need to do something like
{{ article.product.images.first.image.url }}
In my template, but there is no βfirstβ ( images is a RelatedManager for which I have found very little documentation).
Is there any other way to do this? I can get the first model with
{{ article.product.images.get_query_set|first }}
But then I need to dig a few properties deeper, and that doesn't work.
If this helps, my image model looks like this:
class ComponentImage(models.Model): component = models.ForeignKey(Component, related_name='images') image = models.ImageField(upload_to='uploads')
And article.product is Component .
source share