Hi again,
This is getting very frustrating because I can't make this work...
This is exactly what I wrote in the files:
[newforms.py]
from django import newforms as forms
from django.newforms.forms import BoundField
from django.template import Context, loader
class TemplatedForm(forms.Form):
def cc(self):
"Helper function for fieldsting fields data from form."
bound_fields = [BoundField(self, field, name) for name, field
\
in self.fields.items()]
c = Context(dict(form = self, bound_fields = bound_fields))
t = loader.get_template('newforms/form.html')
return t.render(c)
def __str__(self):
return self.output_via_template()
[form.html]
{% for field in bound_fields %}
{% include "newforms/field.html" %}
{% endfor %}
[field.html]
<tr{% if field.errors %} class="errors" {% endif%}>
<th>
<label for="id_{{ field.name }}">{{ field.label }}{% if
field.field.required %}<span class="required">*</span>{% endif %}:</
label>
</th>
<td>
{{ field }}
{% if field.errors %}{{ field.errors }}{% endif %}
{% if field.help_text %}
<p class="helptext">({{ field.help_text }})</p>
{% endif %}
</td>
</tr>
This probably has to be modified to do what I want it to do (present
the error text as simple text and not as <ul>) but I have no idea
where I have to change this to do what I want it to do. I know that
the changes have to be made on the function output_via_template(), but
I just don't know what am I supposed to do there. :(
Ana
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---