On Nov 26, 2:14 pm, ChrisK <[EMAIL PROTECTED]> wrote:
> I'm doing a custom template (probably stupid), and using initial
> values. Here's a precis:
>
> template has
>
> <form action="/map/fences/newFence/" method="POST">
> {{form.url.field.initial}}
> {{form.auth_id}} {{form.media_id}} {{form.fence_id}}
> <p><label for="id_teaser">Reminder String:</label>
> <input id="id_teaser" type="text" name="teaser" maxlength="40" /></
> p>
>
> form type looks like
>
> class editFenceForm(forms.Form):
> teaser = forms.CharField(max_length=40)
> auth_id = forms.CharField(widget=forms.HiddenInput)
> media_id = forms.IntegerField(widget=forms.HiddenInput)
> fence_id = forms.IntegerField(widget=forms.HiddenInput)
>
> invocation looks like
>
> form = editFenceForm(initial={
> 'auth_id' : auth_id, 'fence_id': fence_id, 'media_id':
> m_id,
> 'teaser': m.teaser, })
>
> output html looks like
>
> <form action="/map/fences/newFence/" method="POST">
> None
> <input type="hidden" name="auth_id" value="ckantarj" id="id_auth_id" />
> <input type="hidden" name="media_id" value="13" id="id_media_id" />
>
> <input type="hidden" name="fence_id" value="27" id="id_fence_id" />
> <p><label for="id_teaser">Reminder String:</label>
> <input id="id_teaser" type="text" name="teaser" maxlength="40" /></
> p>
>
> I'm really not expecting "None" there. If I just use {{form.as_p}},
> the values are filled in correctly.
>
> What am I missing?
Obviously, {{form.url.field.initial}} is causing it. The question is,
do you have a field called url in your form. Your Form class
definition above does not show such a field nor are you trying to set
an initial value for it in the form instantiation. Perhaps you want to
paste your test code again?
-Rajesh D.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---