﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7975	"Admin inlines incorrectly report ""this field is required"" if inline model has field with default value"	Russell Keith-Magee	Brian Rosner	"Consider the following model:

{{{
class Person(models.Model):
    name = models.CharField(max_length=128)

class Membership(models.Model):
    person = models.ForeignKey(Person)
    date_joined = models.DateTimeField(default=datetime.now)
}}}

with the following admin definition:
{{{
class MembershipInline(admin.TabularInline):
    model = Membership
    extra = 3

class PersonAdmin(admin.ModelAdmin):
    inlines = (MembershipInline,)
    
admin.site.register(Person, PersonAdmin)
}}}

If you try to add or edit an instance of Person in the admin, you won't be able to save unless you fill in _all_ the extra lines in the inline. 

This appears to be because the default value that is used to populate the inline form is confused with legitimate user-entered content. As a result, all the empty extra rows appear to have been partially filled out, so the validator raises an error for the 'missing' fields.

If you remove the default value from the date_joined field, the problem goes away.

"	Uncategorized	closed	contrib.admin	dev	Normal	fixed	1.0-blocker		Accepted	1	0	0	0	0	0
