Monday, April 29, 2013

Re: quick problem with str and int

You would want to match this, (?P<this_ref>.*),  against a string not integer.


On Mon, Apr 29, 2013 at 11:40 PM, MikeKJ <mike.jones@paston.co.uk> wrote:
So unfortunately due to historical reason a numerical reference is set as a CharField in the model now I want to pass that reference through a url to json serialise something so

<a href="/json/{{ reference }}/>ddddd</a>  as in /json/810044/

so I used /json/{{ reference|add:"0" }}/  to make it an int in the template

but I still get

Exception Type: TypeError at /json/810044/
Exception Value: 'str' object is not callable

the url line is

(r'^json/(?P<this_ref>.*)/$', '/views/json'),

I am not entirely sure where it is complaining about str being uncallable but having cast it to int in the a href in the template  surely it should have resolved?  Any clues please?

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment