Monday, January 31, 2011

Re: Django Admin select boxes

On Mon, Jan 31, 2011 at 4:51 PM, Bjorn Meyer <bjorn.m.meyer@gmail.com> wrote:
> Hi all, I am hoping that someone might be able to point me in the right
> direction for the following problem. I have been searching for a few days now
> and haven't been able to find a way to accomplish this. I have found some
> solutions that are close, but only work on editing an entry, not on add.
> I have models for the following:
> Each have a foreign key to the model above it.
> Country
> Prov/State
> City
> Region
> Community
> Is there a way in the Django admin to filter the values in the select boxes
> based on the selection in the previous select box? eg: I select Canada in the
> country select box, then in the Prov/State select box I am only presented with
> the Provinces. Once that is selected, the City select box only presents cities
> within the Province selected. etc...
> Is this possible?
>

A qualified yes; Of course it is possible, but it's not simply a
question of saying 'Hey django-admin, these fields are related, so do
AJAX goodness', you would need to write it mostly yourself, including
a custom form that adds the additional fields (I assume that you would
only record the low level item, eg 'Community'), adding web service
calls so you can populate those fields, etc etc.

Cheers

Tom

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

No comments:

Post a Comment