Commit c14937cf authored by Jannis Leidel's avatar Jannis Leidel
Browse files

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.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12297 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent df82175c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -295,6 +295,7 @@ answer newbie questions, and generally made Django that much better:
    msaelices <msaelices@gmail.com>
    Martin Mahner <http://www.mahner.org/>
    Matt McClanahan <http://mmcc.cx/>
    Stanislaus Madueke
    Frantisek Malina <vizualbod@vizualbod.com>
    Mike Malone <mjmalone@gmail.com>
    Martin Maney <http://www.chipy.org/Martin_Maney>
@@ -314,6 +315,7 @@ answer newbie questions, and generally made Django that much better:
    mccutchen@gmail.com
    Paul McLanahan <paul@mclanahan.net>
    Tobias McNulty <http://www.caktusgroup.com/blog>
    Zain Memon
    Christian Metts
    michael.mcewan@gmail.com
    michal@plovarna.cz
+3 −0
Original line number Diff line number Diff line
@@ -195,6 +195,9 @@ class InlineAdminFormSet(object):
                self.opts.prepopulated_fields, None, self.readonly_fields,
                model_admin=self.model_admin)

        yield InlineAdminForm(self.formset, self.formset.empty_form,
            self.fieldsets, self.opts.prepopulated_fields, None)

    def fields(self):
        fk = getattr(self.formset, "fk", None)
        for i, field in enumerate(flatten_fieldsets(self.fieldsets)):
+1 −1
Original line number Diff line number Diff line
@@ -365,7 +365,7 @@ input[type=text], input[type=password], textarea, select, .vTextField {

.button, input[type=submit], input[type=button], .submit-row input {
    background: white url(../img/admin/nav-bg.gif) bottom repeat-x;
    padding: 3px;
    padding: 3px 5px;
    color: black;
    border: 1px solid #bbb;
    border-color: #ddd #aaa #aaa #ddd;
+27 −5
Original line number Diff line number Diff line
@@ -247,10 +247,7 @@ fieldset.monospace textarea {
}

.inline-related h3 span.delete {
    padding-left: 20px;
    position: absolute;
    top: 2px;
    right: 10px;
    float: right;
}

.inline-related h3 span.delete label {
@@ -274,6 +271,11 @@ fieldset.monospace textarea {
    color: #fff;
}

.inline-group .tabular fieldset.module {
    border: none;
    border-bottom: 1px solid #ddd;
}

.inline-related.tabular fieldset.module table {
    width: 100%;
}
@@ -320,8 +322,28 @@ fieldset.monospace textarea {
    padding: 0 5px;
}

.inline-group ul.tools a.add {
.inline-group div.add-row,
.inline-group .tabular tr.add-row td {
    color: #666;
    padding: 3px 5px;
    border-bottom: 1px solid #ddd;
    background: #e1e1e1 url(../img/admin/nav-bg.gif) top left repeat-x;
}

.inline-group .tabular tr.add-row td {
    padding: 4px 5px 3px;
    border-bottom: none;
}

.inline-group ul.tools a.add,
.inline-group div.add-row a,
.inline-group .tabular tr.add-row td a {
    background: url(../img/admin/icon_addlink.gif) 0 50% no-repeat;
    padding-left: 14px;
    font-size: 11px;
    outline: 0; /* Remove dotted border around link */
}

.empty-form {
    display: none;
}
+6 −0
Original line number Diff line number Diff line
@@ -49,3 +49,9 @@
.change-list .filtered {
    _height: 400px;
}

/* IE doesn't know alpha transparency in PNGs */

.inline-deletelink {
    background: transparent url(../img/admin/inline-delete-8bit.png) no-repeat;
}
 No newline at end of file
Loading