I posted Previously about this jquery plugin. I have just figured out a very plugable way to get this working in the admin with adding just one form.
Add the following to templates/admin/APP/MODEL/change_form.html and also update the MODEL in the prefix setting.
{% extends "admin/change_form.html" %} {% load i18n admin_modify adminmedia %} {% block extrahead %} {{ block.super }} // Define this so we don't have to bother with the admin jsi18n stuff: function gettext(msgid) { return msgid; } $(function() { $('.inline-related tbody tr').formset({ prefix: 'MODEL_set', addText: 'Add', deleteText: 'Delete', }); }); .add-row { padding-left:18px; background:url({% admin_media_prefix %}img/admin/icon_addlink.gif) no-repeat left center; } .delete-row { float:right; display:block; padding-left:18px; background:url({% admin_media_prefix %}img/admin/icon_deletelink.gif) no-repeat left center; } {% endblock %}
Thanks Stanislaus
Django Dynamic Formset
No comments:
Post a Comment