Sorry for the confusion. I try to be clear, but obviously sometimes
leave out some critical info. I've read and re-read the db-api
document, yet I just couldn't get this to work, at least not the way I
wanted it to.
Here's what I ended up with. It's still not pretty, and I'm sure folks
will have
On 9/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> To clarify, in my model, I've established ManyToMany relationship
> between Sponsor and Section, and all I want to do is return a list of
> sponsors where section = x
>
But you didn't describe what are your models like. So I don't know
To clarify, in my model, I've established ManyToMany relationship
between Sponsor and Section, and all I want to do is return a list of
sponsors where section = x
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
If there's a many to many relationship, shouldn't section already be
aware of the child sponsors?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
On 9/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Well crap... so I'm stuck.
>
> I pass the section when I call the template tag.
> I can match the section (because I only want the sponsors for that
> section) and get the appropriate section object
> But I can't pass the child sponsors
Well crap... so I'm stuck.
I pass the section when I call the template tag.
I can match the section (because I only want the sponsors for that
section) and get the appropriate section object
But I can't pass the child sponsors of the object back to the page?
On 9/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Thanks! That definitely gets the object. I tried to get the child
> sponsor for that section several different ways, but keep running into
> a "Manager isn't accessible via Section instance" errror.
>
Yeah. Only the model class has a
Thanks! That definitely gets the object. I tried to get the child
sponsor for that section several different ways, but keep running into
a "Manager isn't accessible via Section instance" errror.
--~--~-~--~~~---~--~~
You received this message because you are
On 9/5/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> It occurs to me as I look at this further that I don't want to return
> the Section object at all and what I'm really trying to do is get the
> appropriate Section object and then return it's child sponsors.
>
>
Because all() will
It occurs to me as I look at this further that I don't want to return
the Section object at all and what I'm really trying to do is get the
appropriate Section object and then return it's child sponsors.
--~--~-~--~~~---~--~~
You received this message because you
A short cut
register = template.Library()
class SponsorsListNode(template.Node):
def __init__(self, section, varname):
self.section = section
self.varname = varname
def __repr__(self):
return ""
def render(self, context):
context[self.varname] =
What I'm trying to do is grab the site sponsors according to site
section. Some sponsor section A, others section B, etc.
As I have it, I'm returning a list of sponsors filtered by section.
This works, but it seems dumb, since I'm always returning a list of one
(section). In my template, which
12 matches
Mail list logo