Re: Many-To-Many with extra fields

2008-09-23 Thread akonsu
this is untested: m = Membership.objects.select_related().get(person__name='ringo') ringo = m.person i agree, this is not as convenient as could be. may be it will be in the next version? konstantin On Sep 23, 5:16 pm, Nate Thelen <[EMAIL PROTECTED]> wrote: > Yeah, that would work, too.  I

Re: Many-To-Many with extra fields

2008-09-23 Thread Nate Thelen
Yeah, that would work, too. I was thinking more like if you got the ringo like this: ringo = Person.objects.select_related(depth=2).get(name='ringo') how could you get the data without having to make another DB call. Ideas? Thanks, Nate On Sep 23, 2:04 pm, akonsu <[EMAIL PROTECTED]> wrote:

Re: Many-To-Many with extra fields

2008-09-23 Thread akonsu
hello, how about for m in Membership.objects.filter(person=ringo) : print m.date_joined konstantin On Sep 23, 4:58 pm, Nate Thelen <[EMAIL PROTECTED]> wrote: > So if I have a Person object "ringo" and I want to get info about the > Groups he is a member of, I would do this: > > for group in

Re: Many-To-Many with extra fields

2008-09-23 Thread Nate Thelen
So if I have a Person object "ringo" and I want to get info about the Groups he is a member of, I would do this: for group in ringo.group_set.all() print( group.name ) My question is, how do I print the "date_joined" without having to do this: for group in ringo.group_set.all() print(

Re: Many-To-Many with extra fields

2008-09-19 Thread Russell Keith-Magee
On Sat, Sep 20, 2008 at 8:37 AM, Nate Thelen <[EMAIL PROTECTED]> wrote: > > Looking at the docs here: > > http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships > > I cannot find any reference to how to access the data in

Re: Many-To-Many with extra fields

2008-09-19 Thread Rock
In my code I have a reference and a name such that I can do perform a "get" to procure the reference to the correct intermediate object. Then I simply interrogate that object directly. It should be possible to do a "values" style query instead if you only want a particular field or set of fields.

Many-To-Many with extra fields

2008-09-19 Thread Nate Thelen
Looking at the docs here: http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships I cannot find any reference to how to access the data in the "Membership" table. For example, if I have a reference to the "beatles" o