Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » performance fields in forms.py (province/city problem) [RSS Feed]

#1 Jan. 12, 2011 20:09:26

marco c.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

performance fields in forms.py (province/city problem)


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 django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Jan. 13, 2011 11:31:20

marco c.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

performance fields in forms.py (province/city problem)


solved.
thank you all

On Jan 12, 8:59 pm, marco carminati <carminati.ma...@gmail.com> 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 django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Jan. 13, 2011 13:30:00

D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

performance fields in forms.py (province/city problem)


Care to post the solution here (or on a blog)?

On Jan 13, 1:31 pm, marco carminati <carminati.ma...@gmail.com> wrote:
> solved.
> thank you all
>
> On Jan 12, 8:59 pm, marco carminati <carminati.ma...@gmail.com> 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 django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 Jan. 13, 2011 13:57:54

marco c.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

performance fields in forms.py (province/city problem)


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)
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 <gamesb...@gmail.com> wrote:
> Care to post the solution here (or on a blog)?
>
> On Jan 13, 1:31 pm, marco carminati <carminati.ma...@gmail.com> wrote:
>
> > solved.
> > thank you all
>
> > On Jan 12, 8:59 pm, marco carminati <carminati.ma...@gmail.com> 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 django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » performance fields in forms.py (province/city problem) [RSS Feed]

Board footer

Moderator control

Enjoy the 19th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support