Awesome! Thank you and have a great Weekend! :D
Best Regards, Stanwin Siow On Feb 17, 2012, at 1:50 AM, Alasdair Nicol wrote: > Hi Stanwin, > > On 16/02/12 17:43, Stanwin Siow wrote: >> Hello, >> >> I'm trying to modify the default registration forms.py by adding in more >> fields. >> >> Currently it's like that: >> >> ================================================= >> keyword_info = { >> "queryset" : Keyword.objects.all(), >> } >> >> class RegistrationForm(forms.Form): >> <snip> >> keywords = forms.ChoiceField(choices=keyword_info) >> label=_(u'keyword')) >> > You're using a ChoiceField, which requires a list of 2-tuples, for example: > > choices = [('keyword1', 'keyword1'), ('keyword1', 'keyword1')] > > What you probably want is a ModelChoiceField [1], which takes a queryset > argument. > > keywords = forms.ModelChoiceField(queryset=Keyword.objects.all()) > > [1]: https://docs.djangoproject.com/en/dev/ref/forms/fields/#modelchoicefield > > cheers, > > Alasdair > -- > Alasdair Nicol > Developer, MEMSET > > mail: alasd...@memset.com > web: http://www.memset.com/ > > Memset Ltd., registration number 4504980. 25 Frederick Sanger Road, > Guildford, Surrey, GU2 7YD, UK. > > -- > 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 > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.