i think ForiegnKey uses ChoiceField as it has to display n number of choices.
How should we intialize choice field? ------------------------------------------------------- it should in this form source = [(actual value,display value),(actual value,display value) ....................] a list of tuples so at first you need to prepare this list and then you have to intialize. On Jun 19, 5:36 am, adelaide_mike <mike.ro...@internode.on.net> wrote: > Try again. I am new to Django and the web, so I do not know all the > right vocabulary. Sorry. > > I need my ModelForm to be displayed, for creation of a new record, > with a date field and a foreign key (pointing to the Source table) > selector list aleady populated. I am doing this: > > form = ListingForm(initial={'date': request.session['date'], 'source': > source,}) > > The date is correctly displayed. The foreign key selector is not > set. I have tried all combinations I can think of for the source > argument, such as: > > "source": request.session["source"] > "source_id": source_id > "source_id": srequest.session["source_id"] > > In each case a 'print' assures me the value is available. Manually > selecting the 'source' and saving works correctly. > > I would be grateful for any assistance. > > Mike --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---