Open AHAPX opened 7 years ago
Hi. Your script works good for new records, but than I try to edit it, I have a problem.
if I use in template:
<div class="event-dates-formset"> {{ event_dates_formset|crispy }} </div> <script src="{% static 'jquery.formset.js' %}"></script> <script type="text/javascript"> $('.event-dates-formset').formset({ prefix: '{{ event_dates_formset.prefix }}' }); </script>
I can delete existed record in formset, but if I add new one, after POST it's not saved
If I use:
<div class="event-dates-formset"> {% for dt_form in event_dates_formset.forms %} {% if dt_form.instance.pk %}{{ dt_form.DELETE }}{% endif %} {{ dt_form|crispy }} {% endfor %} </div>
I can add new ones, but if I delete one, after POST it's still there.
Do I something wrong?
Not the most efficient solution, but I would suggest comparing the POST data with what's in the DB then delete what's not in the POST data
Hi. Your script works good for new records, but than I try to edit it, I have a problem.
if I use in template:
I can delete existed record in formset, but if I add new one, after POST it's not saved
If I use:
I can add new ones, but if I delete one, after POST it's still there.
Do I something wrong?