﻿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
13223	ValueError with inline and save as new	Luca Lenardi	Igor Sobreira	"Given two models that are related to each other with a foreign key, as follows:

{{{
class Post(models.Model):
    title = models.CharField()
    slug = models.CharField(max_length=200, unique = True)

class Block(models.Model):
    post = models.ForeignKey(Post)
    slug = models.CharField(max_length=200, unique = True)
}}}

Suppose you have set {{{ save_as = true }}} in the admin.py for the class PostAdmin. When you try to create a new Post, generated from an existing one with the ""save as new"" button after correcting some validation errors, the following exception is being generated:
{{{ ValueError: invalid literal for int() with base 10: '' }}}

If you take a look at the request POST parameters, you could find some empty values for the block_set-N-post block_set-N-id (FK and id).

To replicate the error, follow this sequence:

  1. Create a new object with at least one inline
  2. Save it as new with some validation errors
  3. Try to save it again, after correcting the errors of the form


"	Bug	closed	contrib.admin	1.1	Normal	duplicate	admin, save-as-new	kevin1024 andrew@… igor@… samstudio8@…	Accepted	1	0	0	1	0	0
