Revision: 63804
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 7, 2013 21:14 by viroide
Initial Code
@register.filter(name='pk')
def pk(value):
if type(value) == type({}):
if value.has_key('_id'):
value = value['_id']
return unicode(value)
Initial URL
Initial Description
It's imposible to read de "_id" field en django templates ( {{element._id}} === error) So, to read it, you must do a templatetag.
Now you hace the templatetag, you can use it like this: {{element|pk}}
Initial Title
How to read \"_id\" field of an object in django templates
Initial Tags
django
Initial Language
Django