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)
{% if unique_key_object %}
{% for question in unique_key_object %} <p>{{ question.filename }}</p> {% endfor %}{% else %} <p>No data is available.</p>{% endif %}
--
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/b8ee9cc4-1d49-4464-b181-583042182576%40googlegroups.com.
{% for question in unique_key_object %} <p>{{ question.filename }}</p> {% endfor %}
<p>{{ unique_key_object.filename }}</p>
Return the unique key object... Likereturn 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 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/5dc09b06-1daa-432f-b31d-18a698bb0b4b%40googlegroups.com.
On Nov 20, 2019, at 10:25 AM, Andrew Stringfield <lone...@gmail.com> wrote:
I have not! I did see something about that on a website. Would it go something like: dictionary_name.fieldname.0 ? I will try it out later today.
--
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/f1615df3-04bc-4a28-9914-535c51f13268%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2ACBD58F-2A6D-4E23-AD31-2636D22C9C0A%40hotmail.com.