Opened 10 years ago

Closed 10 years ago

#6762 closed (duplicate)

TabularInline in Admin breaks when fields have default values

Reported by: ingenieroariel Owned by: nobody
Component: contrib.admin Version: newforms-admin
Severity: Keywords: inline, default, save, newforms-admin
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


In the following code, everytime the save button is hit in the parent change_form it complains about empty inline model.
I guess it is because default values are assigned to some fields and it tries to save the partially empty objects.

Here is a simple example that works ok, without the default

from django.db import models
from django.contrib import admin
# Create your models here.

class Parent(models.Model):


        ('choice', 'choice'),

        ('choice1', 'choice1'),

class Son(models.Model):
    choice=models.CharField(max_length=20, choices=CHOICES, default='choice')

class SonModelInline(admin.TabularInline):
    model = Son
    extra = 1

class ParentOptions(admin.ModelAdmin):
    inlines = [SonModelInline], ParentOptions)

Change History (1)

comment:1 Changed 10 years ago by Karen Tracey <kmtracey@…>

Resolution: duplicate
Status: newclosed

Dup of #5878, I believe.

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