Opened 13 years ago

Closed 12 years ago

#2725 closed enhancement (worksforme)

edit_inline forces core=True ... core=True forces every *shown* field to be filled in

Reported by: judgej@… Owned by: Adrian Holovaty
Component: contrib.admin Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


A "Profile" can have multiple settings

class Profile(models.Model): name=CharField();

A "Setting" is a variable identifier, as associated value, and action

class Setting(models.Model): myprofile=ForeignKey(Profile,edit_inline=..); identifier=CharField(); value=CharField(); action=BooleanField()

So ...
"Admin -> Profile -> Add" shows the form with Profile files and a few Settings (e.g., 3)

But ...
Setting 1 = identifier: foo value: bar action: [X]
Setting 2 = identifier: aaa value: bbb action: [_]
Setting 3 = leave all fields empty


Django *forces* you to fill in all the offered rows. The required 'core=True' in the setting members force this.
You cannot fulfill the core=True requirement by filling in most of the rows completely.
If you have 2 variables/values/actions, then you cannot save.

There should be a way to remove unwanted edit_inline children ... or allow submission of complete sets of children, but not all the sets offered by the interface.

Work around = set the admin to show only 1 at a time, and force the user to submit and change the Parent multiple times.

Change History (1)

comment:1 Changed 12 years ago by Gary Wilson <gary.wilson@…>

Resolution: worksforme
Status: newclosed

Perhaps the reporter was using core=True in the wrong fields.

Using the following models:

class Profile(models.Model):
    class Admin: pass
    def __str__(self):

class Setting(models.Model):
    myprofile=models.ForeignKey(Profile, edit_inline=models.STACKED,
                                num_in_admin=3, min_num_in_admin=3)
    identifier=models.CharField(maxlength=50, core=True)
    class Admin: pass

    def __str__(self):
        return self.identifier

I can add one or multiple Setting objects in the Add Profile page just fine, and clearing the core=True field removes the Setting object as expected.

Note: See TracTickets for help on using tickets.
Back to Top