Is there a way to do {% url 'blog' blog[i].slug %} in Django?

I want to make this type of loops: {% for i in length %}

where lenth = range(len(blogs)) in And then into that loop I want to do: <a href="{% url 'single_blog' blogs[i].slug %}"> blogs go from too: blogs = Blog.objects.all()

But it shows an error, it says it can't use [i] in this construction. Please let me know, how can I use blogs[i] in Django HTML? Thanks.

Back to Top