Re: Problme in creating dynamic ChoiceField

2014-08-05 Thread VIPUL BANSAL
Hi Daniel, It worked. Thanks a lot :) On Tuesday, August 5, 2014 7:08:34 PM UTC+5:30, Daniel Roseman wrote: > > On Tuesday, 5 August 2014 13:28:28 UTC+1, VIPUL BANSAL wrote: >> >> Hi, >> >> I trying to create a drop-down which gets repopulated every time we land >> on the page. >> >> If I use th

Re: Problme in creating dynamic ChoiceField

2014-08-05 Thread Daniel Roseman
On Tuesday, 5 August 2014 13:28:28 UTC+1, VIPUL BANSAL wrote: > > Hi, > > I trying to create a drop-down which gets repopulated every time we land > on the page. > > If I use the following code everything works correctly: > > class DeleteMappingForm(forms.Form) : > subAreaDropDown = forms.Choi

Problme in creating dynamic ChoiceField

2014-08-05 Thread VIPUL BANSAL
Hi, I trying to create a drop-down which gets repopulated every time we land on the page. If I use the following code everything works correctly: class DeleteMappingForm(forms.Form) : subAreaDropDown = forms.ChoiceField(choices = fetchChoices()) def deleteMapping(request): form = D

Re: Help with Dynamic ChoiceField

2013-03-25 Thread Dilip M
On Mon, Mar 25, 2013 at 4:54 PM, Dilip M wrote: > Hi, > > I am trying to fill in *choices *for MultipleChoiceField in runtime. I > am using formWizard and trying to return the dictionary using get_form_kwargs. > > > I am able set the *initial* for CharField but not *choices *for > MultipleChoic

Help with Dynamic ChoiceField

2013-03-25 Thread Dilip M
Hi, I am trying to fill in *choices *for MultipleChoiceField in runtime. I am using formWizard and trying to return the dictionary using get_form_kwargs. I am able set the *initial* for CharField but not *choices *for MultipleChoiceField. I am trying to show up dynamic choices based on the user'

Re: Passing a dynamic ChoiceField response to a ForeignKey instance

2009-05-19 Thread Simon Greenwood
On May 18, 3:32 pm, Simon Greenwood wrote: > On May 18, 12:02 pm, Simon Greenwood wrote: > > > > > On May 15, 5:58 pm, simong wrote: > > > > There's probably a very simple answer to this but I can't see it at > > > the moment: > > > > This model: > > > > class Product(models.Model): > > >    

Re: Passing a dynamic ChoiceField response to a ForeignKey instance

2009-05-18 Thread Simon Greenwood
On May 18, 12:02 pm, Simon Greenwood wrote: > On May 15, 5:58 pm, simong wrote: > > > > > There's probably a very simple answer to this but I can't see it at > > the moment: > > > This model: > > > class Product(models.Model): > >         user = models.ForeignKey(User, related_name="product_li

Re: Passing a dynamic ChoiceField response to a ForeignKey instance

2009-05-18 Thread Simon Greenwood
On May 15, 5:58 pm, simong wrote: > There's probably a very simple answer to this but I can't see it at > the moment: > > This model: > > class Product(models.Model): >         user = models.ForeignKey(User, related_name="product_list", > editable=False) >         productid = models.CharField(m

Passing a dynamic ChoiceField response to a ForeignKey instance

2009-05-15 Thread simong
There's probably a very simple answer to this but I can't see it at the moment: This model: class Product(models.Model): user = models.ForeignKey(User, related_name="product_list", editable=False) productid = models.CharField(max_length=40, blank=True) prodname = models.C

Re: Dynamic Choicefield

2007-12-15 Thread pinco
pk, thank you very much for your hint, now everything works ok. :-) On 9 Dic, 18:41, pk <[EMAIL PROTECTED]> wrote: > This is a pretty common problem. Each form object gets instantiated as > you need them. > So in your POST handling, you need to instantiate the form with the > same product field

Re: Dynamic Choicefield

2007-12-09 Thread pk
This is a pretty common problem. Each form object gets instantiated as you need them. So in your POST handling, you need to instantiate the form with the same product field so that it can populate the choice field setting correct. i.e. FormForOptionQuantity(product,request) P.K. On Dec 9, 7:31

Re: Dynamic Choicefield

2007-12-09 Thread Karen Tracey
On Dec 9, 2007 7:31 AM, pinco <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm trying to populate dynamically at runtime a choicefield and > subsequently validate the user choice, but without results. > The goal is to permit the user, in an e-commerce application, to > choose the number of products to b

Dynamic Choicefield

2007-12-09 Thread pinco
Hi, I'm trying to populate dynamically at runtime a choicefield and subsequently validate the user choice, but without results. The goal is to permit the user, in an e-commerce application, to choose the number of products to buy through a choicefield, with a list of integer from 1 to a maximum n

Re: Newforms w/ *dynamic* ChoiceField choices?

2007-08-03 Thread Jonathan Buchanan
> Newforms has a spiffy way to dynamically set the "initial" values of > fields, in the view code when the Form is constructed. > choosecolorform = ChooseColorForm(initial={'color': 'black'}) > > I was hoping it would be just as easy to dynamically define the > choices available in a ChoiceField

Re: Newforms w/ *dynamic* ChoiceField choices?

2007-08-02 Thread Thomas Guettler
Am Freitag, 3. August 2007 00:19 schrieb rskm1: > Newforms has a spiffy way to dynamically set the "initial" values of > fields, in the view code when the Form is constructed. > choosecolorform = ChooseColorForm(initial={'color': 'black'}) I think you only can set initial to a value, not to a d

Newforms w/ *dynamic* ChoiceField choices?

2007-08-02 Thread rskm1
Newforms has a spiffy way to dynamically set the "initial" values of fields, in the view code when the Form is constructed. choosecolorform = ChooseColorForm(initial={'color': 'black'}) I was hoping it would be just as easy to dynamically define the choices available in a ChoiceField, too... bu

Re: newforms tip: dynamic ChoiceField

2007-01-18 Thread nesh
* Rubic wrote, On 14.01.2007 18:19: I've been using newforms for a few days now and just ran across something in ChoiceField that might be worth sharing. However, sometimes you'd like the choice list to be dynamic, to reflect the current values in the model. My approach is to create a class

Re: newforms tip: dynamic ChoiceField

2007-01-14 Thread Rubic
I just read Honza Král's post where he describes handling this in __init__: http://tinyurl.com/ync6y9 -- Jeff Bauer Rubicon, Inc. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to t

newforms tip: dynamic ChoiceField

2007-01-14 Thread Rubic
I've been using newforms for a few days now and just ran across something in ChoiceField that might be worth sharing. The most common use case for a choice field is to pass a static list of choices. In the example below, it's a list of flavor choices: model.py: class Flavor(models.Model):