I would like to edit templates online. So i used newforms and
.form_for_instance() to build a html form.
The Problem: If there are django template tags in the content, the tag rendered
by the template engine. But i don't want that. I want to edit the tag in a html
textarea.
Here a small cut out from my source:
-----------------------------------------------------------
from django import newforms as forms
from PyLucid.models import Page
page_instance = Page(
content="Test {{ YYY }} foo bar...",
)
page_instance.save()
Form = forms.models.form_for_instance(page_instance)
html_form = Form()
# in the real code: render to response and not print it out ;)
print html_form.as_p()
-----------------------------------------------------------
One solution i found: Replace "{" and "}". after render the form with .as_p()
Like this:
form = form.replace("{", "{").replace("}", "}")
This works fine. But now i doesn't wand directly render the html code. I used
the "complex template output" described here:
http://www.djangoproject.com/documentation/newforms/#complex-template-output
So i have no change to replace "{" and "}"... If i replace it before i make
.form_for_instance() the escaped sequence "{" would be escaped a second
time to this: "{".
How can i handle this???
--
Mfg.
Jens Diemer
----
A django powered CMS: http://www.pylucid.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---