[Answer]-How to differentiate between already created and new objects in the template while using model formset

1👍

You don’t have to show the complete form, you can loop over the formset like this:

 {% for form in edu_formset %}
      form.FIELDNAME#1.value
      form.FIELDNAME#2.value
      etc.
 {% endfor %}

 <!-- Manually render empty form for new entry -->
 <div class='input'>
     <label>Locality: </label> <input id="FIELDNAME#1" disabled=disabled value="">
     <label>Country:  </label> <input id="FIELDNAME#2" disabled=disabled value="">
     etc.
 </div>

So you’re only showing the database values of all objects send to the template, not the form inputs.

Then indeed with minimal jquery (or plain javascript) you can show/hide the div.input

Leave a comment