Maybe you can do something similar to what's in this post (using queryset): http://groups.google.com/group/django-users/browse_thread/thread/c59b3807631d2914/a07cabfb4725447d?lnk=gst&q=restrict+users+to+their+own+data#a07cabfb4725447d
keith On Sat, Sep 13, 2008 at 10:30 AM, Gertjan Klein <[EMAIL PROTECTED]> wrote: > > Steve Holden wrote: > > >Gertjan Klein wrote: > >> However, there is one obvious problem > >> here: when editing an Hours instance, the ProjectCode dropdown lists > >> *all* project codes, not just those related to the selected customer. > > >As long as you only want this in th admin, check out the > >"ForeignKey.limit_choices_to" attribute. However, I don't know whether > >this would give you the correct results where no project code was > >specified, and I'm not sure how to do this in general applications yet. > > Thanks. I have just tried that, but failed. In the model, I don't know > how to specify that the result should be limited to an attribute of the > instance (e.g., something like self.Customer.id), as there is no self at > that point. This may very well be my lack of understanding, I'm just > starting with Django. > > However, that would still only help with saved instances; when creating > a new Hours entry, the Customer value will be empty, so the dropdown > with appropriate ProjectCodes would be too. > > So the question remains whether the django admin code helps make this > possible... > > Regards, > Gertjan. > > -- > Gertjan Klein <[EMAIL PROTECTED]> > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---