You can't

On Wed, 20 Nov 2019, 3:57 pm Andrew Stringfield, <loneso...@gmail.com>
wrote:

> First, thank you for the reply Suraj!  I think that I misstated what I was
> really trying to do.  I am trying to access the dictionary values directly
> in the Template and not in the View.  I am trying to remove:
>
>         {% for question in unique_key_object %}
>                <p>{{ question.filename }}</p>
>        {% endfor %}
>
> and just have:
> <p>{{ unique_key_object.filename }}</p>
>
>
>
>
> On Tuesday, November 19, 2019 at 10:59:07 PM UTC-5, Suraj Thapa FC wrote:
>>
>> Return the unique key object... Like
>> return render(request, 'abc.html',unique_key)
>>
>> On Wed, 20 Nov 2019, 9:18 am Andrew Stringfield, <lone...@gmail.com>
>> wrote:
>>
>>> Hello all,
>>>
>>>      I am trying to access Dictionary values directly.  Here is my view:
>>>
>>> def unique_key_query(request, unique_key):
>>>         unique_key_object =
>>> simpleformmodel.objects.all().filter(id=unique_key)
>>>         context = {'unique_key_object': unique_key_object}
>>>         return render(request, "bash_file_page.html", context)
>>>
>>> Here is my template:
>>> {% if unique_key_object %}
>>>         {% for question in unique_key_object %}
>>>                 <p>{{ question.filename }}</p>
>>>         {% endfor %}
>>> {% else %}
>>>         <p>No data is available.</p>
>>> {% endif %}
>>>
>>> I can access Dictionary values with a for loop, but I just do not want
>>> to do that.  How can I access the values directly?
>>>
>>> Thank you.
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/b8ee9cc4-1d49-4464-b181-583042182576%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/b8ee9cc4-1d49-4464-b181-583042182576%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/5dc09b06-1daa-432f-b31d-18a698bb0b4b%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/5dc09b06-1daa-432f-b31d-18a698bb0b4b%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/CAPjsHcFwibVAc%2BaiJs76D_Yn%3D1CyO%3DmY%3DvGxoDOn%3DgLTzEYGLw%40mail.gmail.com.

Reply via email to