I want to use the ChoiceField to show choices depending on a query
set. For exmple the ChoiceField must get all active Users and them
show them in a drop down, something like what happens in Admin. How
can I do that?
--~--~-~--~~~---~--~~
You received this message b
ModelChoiceField. Currently not documented, but here's example code.
Use your browser's find for "ModelChoiceField".
http://www.djangoproject.com/documentation/models/model_forms/
On Jan 24, 9:47 pm, shabda <[EMAIL PROTECTED]> wrote:
> I want to use the ChoiceField to show choices depending on
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
YourCoolForm(forms.ModelForm):
~choices_field = forms.ModelChoiceField(
~queryset=UserProfile.objects.all())
~def__init__(self, **kwargs):
~ super(YourCoolForm, self).__init__(**kwargs)
~ self.fields['choices_field'].q
I have mod_python and I'm using ModelChoiceField, but I'm not getting
the expected results, when I change my queryset and the second has
elements not present on the original queryset, it displays the choices
but doesn't validate properly, complaining about the option not being
valid for the set.
4 matches
Mail list logo