Opened 11 years ago

Last modified 7 years ago

#14832 new Bug

Impossible to create inline objects if form validates but is unchanged

Reported by: Julien Phalip Owned by: nobody
Component: contrib.admin Version: 1.4
Severity: Normal Keywords: sprintdec2010
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes


Here's a simple test case:


from django.db import models

class Account(models.Model):
    name = models.CharField(max_length=100)
class Expense(models.Model):
    account = models.ForeignKey(Account)
    amount = models. IntegerField(default=100, blank=True, null=True)
    memo = models.CharField(max_length=100, blank=True)


from django.contrib import admin

from .models import Account, Expense

class ExpenseInlineAdmin(admin.TabularInline):
    model = Expense

class AccountAdmin(admin.ModelAdmin):
    inlines = [ExpenseInlineAdmin], AccountAdmin)

Here there is no way to create an expense object with the amount 100 and no memo. This is because Django compares the submitted values with the initial ones, and takes a (big) guess that the user wants to create an object only because she has *modified* one of the values. If the user is happy with the default values and presses 'save', then the expense object won't get created.

I've discussed this at length with DrMeers and russellm during the Dec2010 sprint. I am conscious that there is no straight forward solution to this, and that this approach was designed prior the inclusion of jquery and also to allow people without javascript to use inlines. However it seems that this system is either flawed by design, or confusing to say the least (as people rely on this behaviour and expect things to work the way they really shouldn't, i.e. #14095).

It feels that some user interface design work needs to be done to make things more explicit and intuitive. Opening this ticket to keep track of this request, as I expect some design discussions need to happen on the mailing list in parallel.

Change History (7)

comment:1 Changed 10 years ago by Russell Keith-Magee

Triage Stage: UnreviewedAccepted

This is a messy problem, and needs some UX love to work out the right solution.

comment:2 Changed 10 years ago by Julien Phalip

#15174 was closed as dupe (different use case but essentially the same problem).

comment:3 Changed 10 years ago by James Addison

Severity: Normal
Type: Bug

comment:4 Changed 10 years ago by Julien Phalip

Easy pickings: unset

#11807 reported the same issue, contains a detailed analysis by kmtracey and has a test case.

comment:5 Changed 10 years ago by Julien Phalip

UI/UX: set

comment:6 Changed 7 years ago by wim@…

Version: 1.21.4

comment:7 Changed 7 years ago by anonymous

The problem still exists in Django 1.4.10

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