On Jan 21, 2008 11:23 AM, lowshoe <[EMAIL PROTECTED]> wrote: > > hi, > > i'm currently trying to create a form with newforms from a model. now > i would like to create an add-form where a selection field shall have > a preselected value. i know that i can pass a data-dictionary when > instantiating the form: > > > FolderForm = forms.models.form_for_model(Folder) > form = FolderForm({'parent': id}) > > If I render this form, i unfortunately get already validation errors > about the other fields that are missing. Is there a way to instantiate > and render a Form without validation or perhaps another possibility to > prefill form fields? >
Sounds like you want dynamic initial values: http://www.djangoproject.com/documentation/newforms/#dynamic-initial-values (You might also want to look at the newer ModelForm instead of form_for_model.) Karen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---