Re: populating forms using models

2008-11-01 Thread Jorge Bastida
To populate select field you have many options. First is using ModelChoiceField. The ModelChoiceField have an argument named queryset, you can use like this example provincia = forms.ModelChoiceField(queryset=Provincia.objects.all() ..) If you can't have a FK of Provincia table you can use a C

Re: populating forms using models

2008-11-01 Thread Rock
In brief, your forms field for province does not have to have anything to do with your corresponding model field. Just make a forms.ChoiceField with the data filled in that you need (or else look up the pattern for loading dynamic data into a forms.ChoiceField and do something like that.) If you g

populating forms using models

2008-10-31 Thread Vokial
Hi I'm working on a registration form which is based, among the others, on this model: class City(models.Model): prov_name = models.CharField(verbose_name='Provincia',max_length=50) (obviously i'm writing down just the field i'm interested in to save some space..) In the form i have to put