Pass your object into the template context, and render its attribute values
with:
<p> attr1 = {{ myobject.attr1 }} </p>
http://docs.djangoproject.com/en/1.1/topics/templates/#variables
On Sun, Apr 11, 2010 at 2:17 AM, deostroll <[email protected]> wrote:
> I am dynamically creating some objects in my python code as follows:
> ---
> class MyObject(object):
> pass
>
> obj = MyObject()
>
> obj.attr1 = 'val1'
> obj.attr2 = 'val2'
> .
> .
> .
> obj.attrabc = 'valabc'
> ---
> I am looking to generate html below:
> ---
> <p> attr1 = val1 </p>
> <p> attr2 = val2 </p>
> .
> .
> .
> <p> attrabc = valabc </p>
> ---
> The challenge is getting to attribute names and the corresponding
> value of the attribute dynamically from within django templates. Is
> there anyway we can do this?
>
> --deostroll
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>
--
Matt McDonald
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.