On Sat, Oct 11, 2008 at 8:05 PM, d. <[EMAIL PROTECTED]> wrote:
>
> Probably a simple, stupid error I'm making:
>
> I try to display a form in a template using:
>
>
> {{ rForm.as_table }}
>
>
>
>
> The browser displays pure html of the form content, having the form-
> source all escaped to something like:
> for="id_username">Username:<
>
> The same happens if I simply display form fields.
>
> What can I do?
> Can somebody please help? Do you need more information?
You're hitting up against the autoescaping features of Django's
template engine. Django automatically escapes template output to
prevent cross site scripting attacks. You can control this behaviour
if you want; for more details, see:
http://docs.djangoproject.com/en/dev/topics/templates/#id2
Yours,
Russ Magee %-)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
Sorry, I first posted this on the django developppers group, which was
obviously wrong.
Probably a simple, stupid error I'm making:
I try to display a form in a template using:
{{ rForm.as_table }}
The browser displays pure html of the form content, having the form-
source all escaped to something like:
Username:<
The same happens if I simply display form fields.
What can I do?
Can somebody please help? Do you need more information?
Thank you very much!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
so I am using the code from the Django documentation to processes
information from a form with the code :
def edit_place(request, place_id):
try:
manipulator = Place.ChangeManipulator(place_id)
place = manipulator.original_object
if request.method == 'POST':
new_data = request.POST.copy()
errors = manipulator.get_validation_errors(new_data)
manipulator.do_html2python(new_data)
if not errors:
manipulator.save(new_data)
return HttpResponseRedirect("/places/edit/%i/" % place.id)
else:
errors = {}
new_data = manipulator.flatten_data()
form = forms.FormWrapper(manipulator, new_data, errors)
return render_to_response('places/edit_form.html', {'form': form,
'place': place})
However in my post data from my form I don't return data for all the
values in my model. This is because I don't want the user to be able
to change some of these, only to see them. I am not sure how to fill
the new_data dict with the old values (ones not being returned from
the form in the post method) when saving to the db.
I have tried using a value old_data=manipulator.flatten_data() and
making a comparison and but have got a error
argument of type 'long' is not iterable
Help?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---
3 matches
Mail list logo