#12508 closed (fixed)
Feature: Dynamically adding inlines
Reported by: | Zain Memon | Owned by: | Jannis Leidel |
---|---|---|---|
Component: | contrib.admin | Version: | soc2009/admin-ui |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This patch adds the ability to add extra inlines dynamically with a "Add new <model>" link at the bottom of the inline. When Javascript is enabled, extra forms for inlines are hidden on load and the "add new <model>" link is unhidden.
Attachments (4)
Change History (9)
by , 15 years ago
Attachment: | adminui-newinlines.diff added |
---|
comment:1 by , 15 years ago
Owner: | changed from | to
---|---|
Triage Stage: | Unreviewed → Accepted |
FYI, my current status can be found here: http://github.com/jezdez/django/tree/admin-ui-combined
("combined" with the select-across feature of #12282 which I've ported to jQuery, as well)
comment:2 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [12297]) Fixed #12508 - Added ability to dynamically add inlines in the admin app.
Refs #13. Also introduces an empty_form
attribute on formsets to make it easier to implement dynamic forms.
Many thanks to Zain Memon for the initial patch from his Summer of Code 2009 project, Stanislaus Madueke for his django-dynamic-formset app and all the other people helping out.
comment:3 by , 15 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
there's a bug with current implementation, when using ManyToManyField and raw_id_admin, the ids of the fields are off-by-one and thus when popup closes the value is entered in a row after the one that the user clicked on to change.
Since ticketing system thinks my patch is a spam, here's a simple patch to make it work:
--- inlines.js (revision 12486)
+++ inlines.js (working copy)
@@ -56,8 +56,8 @@
var template = $("#" + options.prefix + "-empty");
var row = template.clone(true).get(0);
$(row).removeClass(options.emptyCssClass).removeAttr("id").insertBefore($(template));
- $(row).html($(row).html().replace(/prefix/g, nextIndex));
- $(row).addClass(options.formCssClass).attr("id", options.prefix + nextIndex);
+ $(row).html($(row).html().replace(/prefix/g, totalForms.val()));
+ $(row).addClass(options.formCssClass).attr("id", options.prefix + totalForms.val());
if ($(row).is("TR")) {
If the forms are laid out in table rows, insert
the remove button into the last table cell:
comment:4 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
This was fixed, if there's a new bug please file it.
by , 15 years ago
Attachment: | field_numbering_off_by_one.diff added |
---|
Fixes faulty field numbering for ForeigKeys (add link and field. and potentially others)
by , 15 years ago
Attachment: | field_numbering_off_by_one.2.diff added |
---|
Fixes faulty field numbering for ForeigKeys (add link and field. and potentially others)
Fixed a bug related to spaces in verbose_name