Monday, April 29, 2013

Re: quick problem with str and int

How about adding a get_absolute_url method to your model? Then you can take care of the logic there, instead of the template.


Worst-case, you can just do the conversion in your view and assign it as a new property to your model. Since it's just a Python class instance, you can do my_obj.temp_url = (whatever) and then your template can access my_obj.temp_url. 

--
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