﻿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
21156	Inline model admin does not respect model field default values.	tom.vaughan@…	nobody	"Given the abbreviated code below, in the admin view for Project Proposals there will be three (the default value of ""extra"") new Resubmit Project Proposal Links each with their own unique resubmit_id, and there will be a link to ""+ Add another Resubmit Project Proposal Link"". This works the first time it's clicked. That is the new (fourth) Resubmit Project Proposal Link will have a unique (distinct from the first three at least) resubmit_id, let's say 1234. But each time the link is clicked afterwards the resubmit_id in the newly created Resubmit Project Proposal Link will always be 1234.

{{{
def _default_resubmit_id():
    return uuid.uuid4().hex

class ResubmitProjectProposalLink(models.Model):                                                                                                                   
    resubmit_id = fields.RequiredCharField(default=_default_resubmit_id)
    projectproposal = fields.RequiredForeignKey('ProjectProposal', related_name='resubmit_projectproposal_links')

class ResubmitProjectProposalLinkInline(admin.StackedInline):
    model = ResubmitProjectProposalLink

class ProjectProposalAdmin(admin.ModelAdmin):
    inlines = [ResubmitProjectProposalLinkInline]
}}}"	New feature	closed	contrib.admin	1.5	Normal	needsinfo			Unreviewed	0	0	0	0	0	0
