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
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.
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)
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
4 matches
Mail list logo