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
Hi there,
I have cards and decks, decks have ManyToMany cards, and if you want
to add a card, you have to chose a deck; quite simple.
my forms.py contains something like that:
class CardForm(forms.Form):
deck = forms.ChoiceField(required=True,choices=[(d.id,d.name) for
d in Deck.objects.all
5 matches
Mail list logo