Re: Noob here. Accessing data across relationships

2007-06-14 Thread Brian Luft
I recommend writing a custom template tag. (http:// www.djangoproject.com/documentation/templates_python/#writing-custom-template-tags). So you would have for example: { list_member_events object } Then in your template tag code you would be able to handle the logic that is a little too

Re: Noob here. Accessing data across relationships

2007-06-14 Thread [EMAIL PROTECTED]
Thanks for the idea, but that doesn't quite work either. If someone only has 3 events, then the for loop runs through 3 times, and I end up with only three TD's. I'm pretty sure what I need can't be accomplished in template code. I think I need to assign all the variables in view code, then

Re: Noob here. Accessing data across relationships

2007-06-13 Thread [EMAIL PROTECTED]
You just need something like: {% for p in object.events.all %} {% if p.event_name %} {{ p.event_name }}, {% else %}> {% endif %} {% endfor %} You could put the whole row in the IF, if you like. On Jun 12, 8:55 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I

Re: Noob here. Accessing data across relationships

2007-06-12 Thread [EMAIL PROTECTED]
I think that requires more logic in the template than possible. My brain says tot do exactly what you suggest. But my template looks similar to this: {% for p in object.events.all %} {{ p.event_name }}, {%

Re: Noob here. Accessing data across relationships

2007-06-12 Thread Kelvin Nicholson
[snip > > The trouble I'm having is, if someone is not assigned to an event, I > get nothing displayed (duh, there's not an event); except I'm > displaying this in a table, and if I don't have any data, then the > cell formatting doesn't line up correctly. [snip] I just quickly perused your

Noob here. Accessing data across relationships

2007-06-12 Thread [EMAIL PROTECTED]
I'm having trouble pulling/formatting data into my template. I have added some Event items into the database. For the example, we'll say "golfing", "hiking" and "swimming". In my template, using the generic object_list, I want to list each member's information (easy enough) and then each