On 5/7/2009 6:29 PM, Margie wrote:
> I know this question has been pondered in a bunch of posts, and I'm
> sorry to repeat it, but I just can't figure out what is the right
> direction to take.
> 
> Let's say I have a model for a Task:
> 
> class Task(models.Model):
>     owner = models.ForeignKey('auth.User')
>     resources = models.ManyToManyField('auth.User')
> 
> The resources field identifies the set of possible owners for the
> task.  I would like to have the admin change_list view show the
> resources as the choices for the owner field, rather than showing all
> Users.
> 
> Has anyone had success doing this?  Can someone point me in the right
> direction?  Am happy to do some coding or override internal methods.
> I see some people talking about using jquery to do this, but if there
> is a way of overriding an internal method, that seems preferable to
> me.

I'll point you in the right direction: `django.contrib.admin.options`.

Look specifically at `formfield_for_dbfield()` and the various flavors 
of related "hooks." I'll bet you can figure out what to do in your admin 
definition.

-- 
George

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to