Reverse ForeignKey lookups

2006-12-19 Thread Cathy Young
I'm having trouble with generating a QuerySet using a reverse ForeignKey lookup, and I'm not sure why I'm getting an error. Here is my model, with only the relevant attributes shown: def EntryStatus(models.Model): ... user = models.ForeignKey(User) entry = models.ForeignKey(Entry) w

Re: Reverse ForeignKey lookups

2006-12-19 Thread Cathy Young
Chris Ryland wrote: > On Dec 19, 11:16 am, "Cathy Young" <[EMAIL PROTECTED]> wrote: > > > Here is my model, with only the relevant attributes shown: > > > > def EntryStatus(models.Model): > > ... > > user = models.ForeignKey(User) &g

Re: Reverse ForeignKey lookups

2006-12-19 Thread Cathy Young
Chris Ryland wrote: > I'm a relative Django newbie, but I think you need to use something > like > > >> Entry.entrystatus_set.filter(entrystatus__user=3) > > since the ForeignKey is on the EntryStatus model rather than the Entry > model. Thanks Chris, but as far as I know you can't use entrystat

Re: Reverse ForeignKey lookups

2006-12-19 Thread Cathy Young
Chris Ryland wrote: > One more stab: > > On Dec 19, 11:16 am, "Cathy Young" <[EMAIL PROTECTED]> wrote: > > I'm having trouble with generating a QuerySet using a reverse > > ForeignKey lookup, and I'm not sure why I'm getting an error. > &g

Re: how to set the choices of Select Widget by code in the newforms

2007-02-10 Thread Cathy Young
On Feb 10, 5:33 pm, "canen" <[EMAIL PROTECTED]> wrote: > If I understand what you are asking, choices can be set to a function, > as long as it returns the correct format. If you return a generator I > think there is a bug that will only call it the first time the form > is rendered (e.g. if ther

Re: how to set the choices of Select Widget by code in the newforms

2007-02-11 Thread Cathy Young
On Feb 10, 11:42 pm, "gordyt" <[EMAIL PROTECTED]> wrote: > > I don't think there's any way of accessing the request.user from the > > Form class (is there?). If I could pass in the choices when I'm > > instantiating the form from views.py my problem would be solved. Is > > this possible? > > Cathy