Re: dynamic choices based on another field input.

2017-10-22 Thread Derek
See: http://django-autocomplete-light.readthedocs.io/en/master/tutorial.html#filtering-results-based-on-the-value-of-other-fields-in-the-form On Friday, 20 October 2017 13:04:41 UTC+2, rajeev yadla wrote: > > hi have a form which have two fields. one field has a foreignkey from > model A(in ima

Re: Dynamic Choices for ChoiceField

2009-08-01 Thread mviamari
On Jul 31, 7:37 pm, Malcolm Tredinnick wrote: > On Fri, 2009-07-31 at 16:31 -0700,mviamariwrote: > > Hello, > > > I'm trying to make a form for data entry into my database that uses > > ChoiceFields for foreign keys.  Obviously, the ideal choice would be > > ModelChoiceField, however I'm not usin

Re: Dynamic Choices for ChoiceField

2009-07-31 Thread Malcolm Tredinnick
On Fri, 2009-07-31 at 16:31 -0700, mviamari wrote: > Hello, > > I'm trying to make a form for data entry into my database that uses > ChoiceFields for foreign keys. Obviously, the ideal choice would be > ModelChoiceField, however I'm not using the django ORM, so I've > assumed that's not going t

Re: dynamic choices iterator in model field

2008-11-19 Thread Malcolm Tredinnick
On Wed, 2008-11-19 at 09:42 -0800, Delta20 wrote: > A model field may have a 'choices' option to which you assign an > iterable object -- typically a list, but this can also be an iterable > function. Is there a way to assign a class method/function rather than > a module function? No. Python di

Re: dynamic choices for views/newforms

2008-06-29 Thread John Aherne
Daniel Roseman wrote: > On Jun 29, 2:24 pm, John Aherne <[EMAIL PROTECTED]> wrote: > >> OK. I did some more experimenting with ModelChoiceField and my table. >> >> Surprise. It worked when I thought it would not. Why did it work. By >> luck in my model I had the __unicode__ function return the

Re: dynamic choices for views/newforms

2008-06-29 Thread Daniel Roseman
On Jun 29, 2:24 pm, John Aherne <[EMAIL PROTECTED]> wrote: > OK. I did some more experimenting with ModelChoiceField and my table. > > Surprise. It worked when I thought it would not. Why did it work. By > luck in my model I had the __unicode__ function return the right value. > So now I could see

Re: dynamic choices for views/newforms

2008-06-29 Thread John Aherne
John Aherne wrote: > Daniel Roseman wrote: > >> On Jun 29, 11:34 am, John Aherne <[EMAIL PROTECTED]> wrote: >> >> >>> I've been looking at django for a while. Been through the tutorial a few >>> times and read 2 books several times and am still trying to find out how >>> some things wor

Re: dynamic choices for views/newforms

2008-06-29 Thread John Aherne
Daniel Roseman wrote: > On Jun 29, 11:34 am, John Aherne <[EMAIL PROTECTED]> wrote: > >> I've been looking at django for a while. Been through the tutorial a few >> times and read 2 books several times and am still trying to find out how >> some things work. >> >> Instead of an empty form on fi

Re: dynamic choices for views/newforms

2008-06-29 Thread Daniel Roseman
On Jun 29, 11:34 am, John Aherne <[EMAIL PROTECTED]> wrote: > I've been looking at django for a while. Been through the tutorial a few > times and read 2 books several times and am still trying to find out how > some things work. > > Instead of an empty form on first loading, I would like to be ab

Re: dynamic choices in a ChoiceField

2008-01-13 Thread James Bennett
2008/1/13 Alex Koshelev <[EMAIL PROTECTED]>: > When you explicitly write list in choices it evaluates at module > import type. To avoid this write function and pass it as 'choices' > parameter Or... deck = forms.ModelChoiceField(queryset=Deck.objects.all()) -- "Bureaucrat Conrad, you are tec

Re: dynamic choices in a ChoiceField

2008-01-13 Thread Alex Koshelev
Thanks. My mistake On 13 янв, 21:39, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Alex Koshelev wrote: > > When you explicitly write list in choices it evaluates at module > > import type. To avoid this write function and pass it as 'choices' > > parameter > > > def get_choices(): > > [(d.id,d.

Re: dynamic choices in a ChoiceField

2008-01-13 Thread Fredrik Lundh
Alex Koshelev wrote: > When you explicitly write list in choices it evaluates at module > import type. To avoid this write function and pass it as 'choices' > parameter > > def get_choices(): > [(d.id,d.name) for d in Deck.objects.all()] (adding a return statement might be a good idea /F)

Re: dynamic choices in a ChoiceField

2008-01-13 Thread Alex Koshelev
When you explicitly write list in choices it evaluates at module import type. To avoid this write function and pass it as 'choices' parameter def get_choices(): [(d.id,d.name) for d in Deck.objects.all()] #... deck = forms.ChoiceField(required=True,choices = get_choices ) When this function

Re: Dynamic choices

2006-02-14 Thread Chetan Vaity
Thanks Amit and Adrian,I think I'll do something like what Amit said or write a custom manipulator.- ChetanOn 2/8/06, Adrian Holovaty < [EMAIL PROTECTED]> wrote:On 2/8/06, Amit Upadhyay < [EMAIL PROTECTED]> wrote:> > What I notice is that whenever an entry is added to LDAP, it is not> reflected in

Re: Dynamic choices

2006-02-08 Thread Adrian Holovaty
On 2/8/06, Amit Upadhyay <[EMAIL PROTECTED]> wrote: > > What I notice is that whenever an entry is added to LDAP, it is not > reflected in the SelectField drop-down on the create form for the model. But > if I simply restart the Apache httpd server, the drop-down is correctly > populated. > > > >

Re: Dynamic choices

2006-02-08 Thread Amit Upadhyay
On 2/8/06, Chetan Vaity <[EMAIL PROTECTED]> wrote: class MyModel(meta.Model):     id = meta.AutoField(primary_key = True)     name = meta.CharField(maxlength=20, unique=True)     location = meta.CharField(maxlength=100, choices=getLocationChoices()) What I notice is that whenever an entry is added

Re: dynamic choices

2005-10-20 Thread stava
stava wrote: > I'm having a bit of a problem with dynamic choices. I'm working on a > simple timesheet system where I've extended the auth.users with a > couple of fields including something I call "primary group": > > def getUsers(group = None): > users = [] > if group is None: > for u i