Saturday, December 12, 2020

How can you do a for loop with a database?

Example:
context = (database model)

def index(request):
     render(index.html, context)

HTML Template:

{% for i in context %}
     <h1>{ database.text }</h1>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/035bd359-0df5-4d1c-b7b7-f4e08584c288n%40googlegroups.com.

No comments:

Post a Comment