i using django-dynamic-formset create inline forms (samforms) within form(expform).(reference: http://kevindias.com/writing/django-class-based-views-multiple-inline-formsets/) works fine except when want create unique id each form added. say, when click "add another", can have id "sample-1, sample-2,etc". tried loop counter in template not work. here code:
in template:
<form> <div class="section"><span>1</span>meta data</div> <div class="inner-wrap"> {{ expform.as_p }} </div> <div class="section"><span>2</span>samples</div> <div class="inner-wrap"> {{ samforms.management_form }} {{ samforms.non_form_errors }} {% form in samforms %} <div class="inline {{ samforms.prefix }}"> <label> sample </label> {{ form.as_p }} </div> {% endfor %} </div> <div class="button-section" align="center"> <input type="submit" name='create_exp' value="create experiment" class="submit" /> </div> </form> } i want have unique id each form in samforms
Comments
Post a Comment