Hi,
I am new to Django and need some help. My issue is on my web page the data
is showing up like this: [u'Green'] and I want it to only show Green -
without the unicode wrapping. Can you please explain why this is happening
and how do I fix it?
Here is my code.
*models.py:*
Class Name(mo
Try:
{{ name.0.name }}
On Thu, Oct 17, 2013 at 2:30 PM, Andrew Michael wrote:
> Hi,
>
> I am new to Django and need some help. My issue is on my web page the data
> is showing up like this: [u'Green'] and I want it to only show Green -
> without the unicode wrapping. Can you please explain
Unfortunately, that did not work. When I put that in the template I get
nothing for name, not even [u'Green'].
Any other thoughts?
On Thursday, October 17, 2013 4:19:57 PM UTC-4, ke1g wrote:
>
> Try:
>
> {{ name.0.name }}
>
>
> On Thu, Oct 17, 2013 at 2:30 PM, Andrew Michael
>
> > wrote:
On Thursday, 17 October 2013 19:30:09 UTC+1, Andrew Michael wrote:
> Hi,
>
> I am new to Django and need some help. My issue is on my web page the data
> is showing up like this: [u'Green'] and I want it to only show Green -
> without the unicode wrapping. Can you please explain why this is hap
Have you tried used get instead filter?
2013/10/17 Daniel Roseman :
> On Thursday, 17 October 2013 19:30:09 UTC+1, Andrew Michael wrote:
>>
>> Hi,
>>
>> I am new to Django and need some help. My issue is on my web page the data
>> is showing up like this: [u'Green'] and I want it to only show Gree
Andrew, I think that the view is missing something:
def enter_name(request):
my_number = request.user.number
name = Name.objects.filter(pk=my_number).values_list('city', flat=True)
*data = {...}
*
*return render_to_response('template.html', data,
context_instance=RequestContext
Thanks to Leonardo, Daniel and Charly this issue is resolved! Each of your
comments helped me.
I changed my views.py file filter statement:
FROM: name = Name.objects.filter(pk=my_**number).values_list('city',
flat=True)
TO: name = Name.objects.get(pk=number).name
And in my template I have the s
7 matches
Mail list logo