Which version of Django do you using?

вторник, 26 января 2016 г., 23:14:03 UTC+2 пользователь suabiut написал:
>
> When i did that i got the error:
>
> 'dict' object has no attribute 'render_context'
>
>
>
> On Tue, Jan 26, 2016 at 7:25 PM, <aspe...@gmail.com <javascript:>> wrote:
>
>> Try this
>> def foreginexchange_view(request):    
>>     t = loader.get_template("template.html")
>>     test=ball.objects.filter(request="checked").count()    
>>     return HttpResponse(t.render({'test': test}))
>>
>> On Tuesday, January 26, 2016 at 4:45:52 AM UTC+2, suabiut wrote:
>>>
>>> Thanks James,
>>> here is my view.py
>>>
>>> def foreginexchange_view(request):
>>>     test=ball.objects.filter(request="checked").count()
>>>     return render(request,'template.html',locals())
>>>
>>>
>>>
>>> Cheers
>>>
>>>
>>>
>>>
>>> On Tue, Jan 26, 2016 at 1:30 PM, James Schneider <jrschn...@gmail.com> 
>>> wrote:
>>>
>>>>
>>>> On Jan 25, 2016 6:07 PM, "sum abiut" <sua...@gmail.com> wrote:
>>>> >
>>>> > Hi,
>>>> > i am trying to count the number of fields that has request field 
>>>> begin checked and then display the value of count in a template.html but i 
>>>> am not sure how to go about doing that.
>>>> >
>>>> > For example i want to do something like
>>>> >
>>>> > test=ball.object.filter(request="checked").count()
>>>> >
>>>> > then on a template.html i want to out put the value of test
>>>> >
>>>> > {{test}}
>>>> >
>>>> > i have try that but i am not getting any value from the output.
>>>> >
>>>>
>>>> Can you post your view? You would run that query in your view and then 
>>>> pass it to your template through the context.
>>>>
>>>> -James
>>>>
>>>> -- 
>>>> 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 post to this group, send email to django...@googlegroups.com.
>>>> Visit this group at https://groups.google.com/group/django-users.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUgThuMtZvUj3QHxLKFHiRu67oTZuvfoLT3K9EpNt08Dg%40mail.gmail.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUgThuMtZvUj3QHxLKFHiRu67oTZuvfoLT3K9EpNt08Dg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>>
>>> -- 
>> 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 <javascript:>.
>> To post to this group, send email to django...@googlegroups.com 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/24038981-7076-4287-9a8d-31e3d83ab7d0%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/24038981-7076-4287-9a8d-31e3d83ab7d0%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a95743cd-8d68-4f92-91c9-c49ca7dfc329%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to