Hi!
I'm trying to create a generic form template for a custom admin zone.
I'm doing it this way: 
http://www.djangoproject.com/documentation/newforms/#complex-template-output

But I need to modify the output depending of the field type.
It's easy to add a javascript calendar in a DateField if you add a
custom class to it, but I need to go further.
I want to check within the template if the field type is a ImageField,
and if True, add:
<tr>
    <th>Thumbnail</th>
    <td><img src="field_path" ... /></td>
</tr>

The problem here is that I can't determine the field type within the
{% for field in form %}{% endfor %} loop.

I'd like something like this  (this is a simplified version):

{% for field in form %}
    <th>{{ field.label_tag }}</th>
    <td>{{ field }}</td>
     <!-- This is what I wish it could be done-->
    {% ifequal field.type 'ImageField' %}
          <th>Thumbnail</th>
           <td><img src="{{ field.data }}" /></td>
     {% endif %}
{% endfor %}

Is there any workaround to make it work?

Thank you.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to