I did not realize it was a dictionary haha

On Monday, December 14, 2020 at 9:53:40 AM UTC-5 Shahprogrammer wrote:

> No it is a dictionary representation of your data
>
> On Monday, 14 December 2020 at 19:55:54 UTC+5:30 prth...@gmail.com wrote:
>
>> is (items) the model name?
>>
>> On Sunday, December 13, 2020 at 8:12:30 AM UTC-5 andrea...@hypercode.se 
>> 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 <prth...@gmail.com>:
>>>
>>> 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...@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
>>>  
>>> <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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/781beced-b456-41bc-b8f7-20ea88367668n%40googlegroups.com.

Reply via email to