Re: limit_choices_to: getting access to current instance

2007-01-31 Thread qhfgva
Well, either I'm not able to follow your example or we are talking about different things. In any case here is what I got working as a first draft. As a big benefit to me is the fact that I now understand these inner workings a little better. I was hoping to get away with simple wrappers to gen

Re: limit_choices_to: getting access to current instance

2007-01-30 Thread quentinsf
Sorry, the reference to 'Display' should have been to 'MyObject' --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscrib

Re: limit_choices_to: getting access to current instance

2007-01-30 Thread quentinsf
I'm not quite sure if this is helpful - it's not a general solution on the ForeignKey specification so wouldn't work in admin, for example, but it worked for me with my own form... I was creating a view for a 'change' form. One parameter passed to the view (from the URL) was an organisation i

Re: limit_choices_to: getting access to current instance

2007-01-30 Thread [EMAIL PROTECTED]
As far as I understand, you could certainly implement the same functionality in a view using newforms to validate the input. To do it in the model, something like the patch suggested in the ticket or the approach linked to at the end of the comments on that ticket would be needed. The code her

Re: limit_choices_to: getting access to current instance

2007-01-29 Thread qhfgva
Thanks for the response. I'm not sure if this exactly covers my case but I like this feature. From the example given in the ticket: def assigned_tasks(): return get_assigned_tasks_id_list(blah, blah) class TimeRecord(models.Model): task = models.ForeignKey(Task, limit_choices_to = {'id_

Re: limit_choices_to: getting access to current instance

2007-01-29 Thread [EMAIL PROTECTED]
See patch on ticket . On Jan 29, 8:31 am, "qhfgva" <[EMAIL PROTECTED]> wrote: > If my original post was not entirely clear, I'm interested in any > method available to limit_choices_to that lets you dynamically create > the list of available options as a

Re: limit_choices_to: getting access to current instance

2007-01-29 Thread qhfgva
If my original post was not entirely clear, I'm interested in any method available to limit_choices_to that lets you dynamically create the list of available options as a function of the current model instance. thanks. On Jan 28, 4:28 pm, "qhfgva" <[EMAIL PROTECTED]> wrote: > I currently have

limit_choices_to: getting access to current instance

2007-01-28 Thread qhfgva
I currently have a drop down for a model where I'd only like to show choices that are currently "active". That's easy enough with: foo = models.ForeignKey(Foo, limit_choices_to={'active__exact':True}) But if someone is working with a model where the "foo" that they had previousl