Doh!
If I had taken the time to read a post from two hours earlier I would
have seen the answer. Use "initial" when instantiating the form. The
last line below does the trick.

    if request.method == 'POST':
        form = FormClass(request.POST)
        if form.is_valid():
            project = form.save(commit=False)
            project.save()
            return HttpResponseRedirect("/webtools/project/")
    else:
        if acct:
            # if the account is valid, set it as the default in the
choice field
            try:
                account = Account.objects.get(id=acct)
            except Account.DoesNotExist:
                form = FormClass()
            else:
                # set default choice
                form = FormClass(initial={'account': account.id})


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to