Patches are welcome!

On Wed, Feb 2, 2011 at 07:48, Derek <gamesb...@gmail.com> wrote:

> I suspect I am not the only one really hoping for An Official Way to
> be developed at some time...
>
> In the meantime, also look at:
> http://www.stereoplex.com/blog/filtering-dropdown-lists-in-the-django-admin
>
> I think this is quite detailed and has some good comments as well.
>
> On Feb 1, 7:07 pm, shacker <shac...@birdhouse.org> wrote:
> > On Jan 31, 6:40 am, sushanth Reddy <sushant...@gmail.com> wrote:
> >
> > > I am trying to create a dynamic filtered drop down choice fields,i gone
> > > through below blog but it confusing,can any one suggest easy way to do
> this
> > > in django.
> >
> > Do you mean in the admin or on your live site? If in the admin,  check
> > out the docs on ModelAdmin.formfield_for_foreignkey:
> >
> > http://docs.djangoproject.com/en/1.1/ref/contrib/admin/
> >
> > class MyModelAdmin(admin.ModelAdmin):
> >     def formfield_for_foreignkey(self, db_field, request, **kwargs):
> >         if db_field.name == "car":
> >             kwargs["queryset"] =
> > Car.objects.filter(owner=request.user)
> >             return db_field.formfield(**kwargs)
> >         return super(MyModelAdmin,
> > self).formfield_for_foreignkey(db_field, request, **kwargs)
> >
> > If you're trying to do this on your live site, you can do whatever
> > filtering you like in your view of course.
>
> --
> 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<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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