is (items) the model name?
On Sunday, December 13, 2020 at 8:12:30 AM UTC-5 [email protected]
wrote:
> The context needs to be a dictionary.
>
> Something like this would work:
> context = {
> ‘items’: Model.objects.all()
> }
>
> Then in the template:
> {% for item in items %}
> <h1>{{ item.text }}</h1>
> {% endfor %}
>
> Here ‘text’ is the property on the database model you want to display.
>
>
> Regards,
>
>
> Andréas
>
> 12 dec. 2020 kl. 17:11 skrev Peter T <[email protected]>:
>
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/035bd359-0df5-4d1c-b7b7-f4e08584c288n%40googlegroups.com
>
> <https://groups.google.com/d/msgid/django-users/035bd359-0df5-4d1c-b7b7-f4e08584c288n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/4e64c96a-c925-4d1b-a49e-75ecedd15276n%40googlegroups.com.