Friday, March 1, 2013

how to create formset field but not used loop in template

When i create formset in template i must used loop "for":

{{ formset_create_company.management_form }}

{% for form in formset_create_company.forms %}

        <div class="block">

        <div class="column_1">

        <div class="field">

        <p>{{ form.postal_code.label }}</p>

        {{ form.postal_code }}

        </div>

        <div class="field">

        <p>{{ form.city.label }}</p>

        {{ form.city }}

        </div>

        </div>

      <div class="column_2">

    <p>{{ form.street.label }}</p>

    {{ form.street }}

    </div>

    <div class="column_3">

    <div class="field">

        <p>{{ form.no_house.label }}</p>

        {{ form.no_house }}

        </div>

        <div class="field">

        <p>{{ form.no_local.label }}</p>

        {{ form.no_local }}

        </div>

        </div>

    </div>

{% endfor %}


OR


{{ formset_create_company.management_form }}

{% for field in formset_create_company %}

    <div class="block">

        {{ field.errors }}

        {{ field.label_tag }}: {{ field }}

    </div>

{% endfor %}


How to create field but not used loop "for"? eg. {{ formset_create_company.form.no_house }}??

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment