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__in': assigned_tasks}) I would like the assigned_tasks function to be have a reference to and be able to calculate values based on the current instance of TimeRecord. Perhaps that is what blah or blah are but I'm guessing not. Do I need to do something like work directly with newforms to achieve something like this? On Jan 29, 6:54 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > See patch on ticket <http://code.djangoproject.com/ticket/2445>. > > 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 function of the current model > > instance. > > > thanks. > > > On Jan 28, 4:28 pm, "qhfgva" <[EMAIL PROTECTED]> wrote: > > > > 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 > > > previously selected has been subsequently set to inactive they should > > > be able to keep that foo (they are "grandfathered" in). > > > > In effect I'd like limit_choices_to to have a list of foo.active == > > > True plus the current selection they have from the past if it is not > > > an active choice. > > > > If I could make a method of Foo such as Foo.allowed_choice_for_x and > > > then pass it an instance of the current object, then it seems like I > > > could easily generate the specific drop downlist on the fly but I'm > > > not sure how to do that (or if it's possible). > > > > Thoughts? --~--~---------~--~----~------------~-------~--~----~ 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 unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---