-----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'].queryset = UserProfile.objects.filter(online=True) or something simular shabda пишет: | 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? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iD8DBQFHmdJZHoZOXY8LFOARAoJ4AKCqv8DJBSDCmYgqof2/eL5YjlV56gCePvnA irB4Qyw9X0Vtjfekl6M+7Lc= =ZpN8 -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---