Re: Directly Accessing Dictionary Values

2019-11-22 Thread Sencer Hamarat
Hello Andrew, If you sure you have only one object, or the first item is enough to do something in template; You can access value by calling object with index number of the object by {% unique_key_object.0.filename %} usage. If there is no object in unique_key_object, template engine might fail si

Re: Directly Accessing Dictionary Values

2019-11-22 Thread Daniel Roseman
On Wednesday, 20 November 2019 03:47:24 UTC, Andrew Stringfield 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) >

Re: Directly Accessing Dictionary Values

2019-11-21 Thread Jim Illback
Check out this URL and the embedded Django link in the answers: https://stackoverflow.com/questions/1700661/how-to-access-array-elements-in-a-django-template. On Nov 20, 2019, at 10:25 AM, Andrew Stringfield mailto:loneso...@gmail.com>> wrote: I have not! I did see something about that on a w

Re: Directly Accessing Dictionary Values

2019-11-20 Thread Andrew Stringfield
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 receivi

Re: Directly Accessing Dictionary Values

2019-11-20 Thread Jim Illback
Have you tried for the first element, and so forth? Of course, you have to keep track of the number of entries. > On Nov 20, 2019, at 5:57 AM, Andrew Stringfield wrote: > > Okie-dokie. Thank you. > > -- > You received this message because you are subscribed to the Google Groups > "Django

Re: Directly Accessing Dictionary Values

2019-11-20 Thread Andrew Stringfield
Okie-dokie. 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-users+unsubscr...@googlegroups.com. To view this discussion on the web visit http

Re: Directly Accessing Dictionary Values

2019-11-20 Thread Suraj Thapa FC
You can't On Wed, 20 Nov 2019, 3:57 pm Andrew Stringfield, 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: > > {

Re: Directly Accessing Dictionary Values

2019-11-20 Thread Andrew Stringfield
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 %} {{ question.filename }

Re: Directly Accessing Dictionary Values

2019-11-19 Thread Suraj Thapa FC
Return the unique key object... Like return render(request, 'abc.html',unique_key) On Wed, 20 Nov 2019, 9:18 am Andrew Stringfield, wrote: > Hello all, > > I am trying to access Dictionary values directly. Here is my view: > > def unique_key_query(request, unique_key): > unique_key