Hi guys, im using something like this:
field1 = forms.ModelChoiceField(queryset=...)
Now how ill show selected x value from the database?
thanks
Hi guys, im using something like this:
field1 = forms.ModelChoiceField(queryset=...)
Now how ill show selected x value from the database?
thanks
Not quite sure I understand what you are asking. Are you talking about setting the default initial value? If so, you should be defining initial like other form fields except you set it to the id instead. Link provided as source since I can't actually double check this where I'm at currently. I'm also assuming you've defined unicode for your models so this displays correctly.
(I'd include the link to django docs for 'initial' but I'm only allowed 1 hyperlink =/)