Jeremy Dunck wrote:
> On 7/8/07, Carl Karsten <[EMAIL PROTECTED]> wrote:
>> Right look, wrong source. My {{object}} is the results of a calendar display
>> with a bunch of these: http://dell29:8000/eventcal/detail/600/
>
> I seriously doubt "dell29:8000" is resolvable for me. :)
actually it was just the eventcal/detail/600/ I wanted to show. but if you are
interested, I'll setup a public url. I'll need to find some sample data. and
make coffee. I'll let you know when it is up.
>
>
>> But that circumvents the view and {% extends "main.html" %} and the plan to
>> hear
>> "yes, that is the right data, lets make it look pretty" and have some clue
>> what
>> attributes object has, just by looking at the 'raw' version rendered in the
>> browser.
>
> Sorry, I don't follow. :-/
I am looking for a tag that does introspection of objects passed to templates.
databrowse takes an ID, gets the record from the db and displays the results in
a pleasing fashion: attributes and data, alternating colors.
I want a similar display, but for an object created in a view, and in my own
template. I like the alternating colors, but I can do without them.
{%debug%} is similar to what I want. Not used by the end user in a final
product, just something handy for development.
the generic view (and most custom views) create something like this:
>>> object={'a':1, 'b':'hello'}
in a template, I want a generic way to show it's attributes and their values:
>>> for i in object: print i, object[i]
a 1
b hello
hmm, I see a slight problem: it really needs a bit of html.
>>> for i in object: print "<tr><td>%s</td><td>%s</td></tr>" % (i, object[i])
...
<tr><td>a</td><td>1</td></tr>
<tr><td>b</td><td>hello</td></tr>
I can see a few ways of dealing with the need for html - something like this:
http://code.djangoproject.com/wiki/ColumnizeTag "This tag will create
<tr></tr>
and <td></td> tags around everything between..."
or even just display the dict in python dict notaion:
>>> object
{'a': 1, 'b': 'hello'}
At this point, the person who is going to actually code the template can see
what attributes/values object has, and can create a real template using
{{object.a}} and {{object.b}}
Carl K
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---