I create a def that gives to me the potential cities I could have and
setup this in the __init__ of my form.
def get_cities(Istance):
city_list = City.objects.filter(id = 0)
province_list_id =
Istance.objects.all().values('province').distinct().order_by('province')
for province_id in province_list_id:
city_list = city_list | City.objects.filter(province__id =
province_id['province'])
return city_list
for my case that's ok, but I dont know if this can help you
On Jan 13, 2:29 pm, Derek <[email protected]> wrote:
> Care to post the solution here (or on a blog)?
>
> On Jan 13, 1:31 pm, marco carminati <[email protected]> wrote:
>
> > solved.
> > thank you all
>
> > On Jan 12, 8:59 pm, marco carminati <[email protected]> wrote:
>
> > > Dear all,
> > > i'm trying to improve the performance during the modify of one of my
> > > models'
>
> > > I've the classic province and city structure.
>
> > > In the 'insert form', using jquery, I can update the city queryset
> > > after the user choice the province.
>
> > > In the 'update form', I would like to set the city's queryset,
> > > filtering the value I've already got in the province.
>
> > > How could I get the province's value without using jquery (i.e. could
> > > I get the province's value in forms.py)?
>
> > > Thanks in advanced
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
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.