diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
--- a/django/contrib/admin/options.py
+++ b/django/contrib/admin/options.py
@@ -970,6 +970,7 @@
             'inline_admin_formsets': inline_admin_formsets,
             'errors': helpers.AdminErrorList(form, formsets),
             'app_label': opts.app_label,
+            'saveasnew': "_saveasnew" in request.POST,
         }
         context.update(extra_context or {})
         return self.render_change_form(request, context, form_url=form_url, add=True)
diff --git a/django/contrib/admin/templates/admin/change_form.html b/django/contrib/admin/templates/admin/change_form.html
--- a/django/contrib/admin/templates/admin/change_form.html
+++ b/django/contrib/admin/templates/admin/change_form.html
@@ -62,7 +62,7 @@
 {% block after_related_objects %}{% endblock %}
 
 {% submit_row %}
-
+{% if saveasnew %}<input type="hidden" value="_saveasnew" name="_saveasnew">{% endif %}
 {% if adminform and add %}
    <script type="text/javascript">document.getElementById("{{ adminform.first_field.id_for_label }}").focus();</script>
 {% endif %}
diff --git a/tests/regressiontests/admin_inlines/models.py b/tests/regressiontests/admin_inlines/models.py
--- a/tests/regressiontests/admin_inlines/models.py
+++ b/tests/regressiontests/admin_inlines/models.py
@@ -217,3 +217,23 @@
 
 admin.site.register(Poll, PollAdmin)
 admin.site.register(Novel, NovelAdmin)
+
+# Models for testing bug #13223 fix
+class Post(models.Model):
+    title = models.CharField(max_length=200)
+
+class Block(models.Model):
+    post = models.ForeignKey(Post)
+    slug = models.CharField(max_length=200, unique=True)
+
+    def __unicode__(self):
+        return self.slug
+
+class BlockInline(admin.TabularInline):
+    model = Block
+
+class PostAdmin(admin.ModelAdmin):
+    save_as = True
+    inlines = [BlockInline]
+
+admin.site.register(Post,PostAdmin)
diff --git a/tests/regressiontests/admin_inlines/tests.py b/tests/regressiontests/admin_inlines/tests.py
--- a/tests/regressiontests/admin_inlines/tests.py
+++ b/tests/regressiontests/admin_inlines/tests.py
@@ -4,7 +4,8 @@
 
 # local test models
 from models import (Holder, Inner, InnerInline, Holder2, Inner2, Holder3,
-    Inner3, Person, OutfitItem, Fashionista, Teacher, Parent, Child)
+    Inner3, Person, OutfitItem, Fashionista, Teacher, Parent, Child, Post,
+    Block)
 
 
 class TestInline(TestCase):
@@ -113,6 +114,86 @@
         self.assertContains(response, '<p class="help">Awesome stacked help text is awesome.</p>', 4)
         self.assertContains(response, '<img src="/static/admin/img/icon-unknown.gif" class="help help-tooltip" width="10" height="10" alt="(Awesome tabular help text is awesome.)" title="Awesome tabular help text is awesome." />', 1)
 
+    def test_save_as_new_with_validation_error_in_inlines(self):
+        """
+        #13223 - ValueError shouldn't happen after using 'Save as new' and
+        correcting a validation error in an inline.
+        """
+        p = Post.objects.create(title='Post title')
+        b1 = p.block_set.create(slug='test1')
+        b2 = p.block_set.create(slug='test2')
+
+        initial_posts_count = Post.objects.count()
+        initial_blocks_count = Block.objects.count()
+
+        # Emulate edition of our Post object in the admin and then submittal
+        # with the 'Save as new' button but triggering a validation error in
+        # the Block inlines
+        data = {
+            'title': 'Second Post title',
+
+            'block_set-TOTAL_FORMS': 5,
+            'block_set-INITIAL_FORMS': 2,
+            'block_set-MAX_NUM_FORMS': 0,
+            'block_set-0-id': b1.id,
+            'block_set-0-post': p.id,
+            'block_set-0-slug': b1.slug,
+            'block_set-1-id': b2.id,
+            'block_set-1-post': p.id,
+            'block_set-1-slug': b2.slug,
+            'block_set-2-id': '',
+            'block_set-2-post': p.id,
+            'block_set-2-slug': '',
+            'block_set-3-id': '',
+            'block_set-3-post': p.id,
+            'block_set-3-slug': '',
+            'block_set-4-id': '',
+            'block_set-4-post': p.id,
+            'block_set-4-slug': '',
+            'block_set-__prefix__-id': '',
+            'block_set-__prefix__-post': p.id,
+            'block_set-__prefix__-slug': '',
+
+            '_saveasnew': u'Save as new',
+        }
+        response = self.client.post('/test_admin/admin/admin_inlines/post/%s/' % p.id, data)
+        self.assertEqual(response.status_code, 200)
+        # Verify that an error has been reported
+        self.assertEqual(response.context['inline_admin_formset'].formset.errors[0]['slug'],
+            [u'Block with this Slug already exists.'])
+        self.assertContains(response, '<input type="hidden" value="_saveasnew" name="_saveasnew">')
+
+        # Correct the inline data so it validates. Also, add a new Block inline
+        # (for a total of three). This time we are presented with the 'Save'
+        # button, use it to submit the form.
+        data = {
+            'title': 'Second Post title',
+
+            'block_set-TOTAL_FORMS': 5,
+            'block_set-INITIAL_FORMS': 2,
+            'block_set-MAX_NUM_FORMS': 0,
+            'block_set-0-slug': 'test4',
+            'block_set-1-slug': 'test5',
+            'block_set-2-slug': 'test6',
+            'block_set-3-slug': '',
+            'block_set-4-slug': '',
+            'block_set-__prefix__-id': '',
+            'block_set-__prefix__-post': p.id,
+            'block_set-__prefix__-slug': '',
+
+            '_saveasnew': u'_saveasnew',
+            '_save': u'Save',
+        }
+        # Re-submit the form, take in account we will be redirected:
+        response = self.client.post(
+            '/test_admin/admin/admin_inlines/post/%s/' % p.id,
+            data, follow=True)
+        self.assertEqual(response.status_code, 200)
+        # Verify the new objects were correctly created
+        self.assertEqual(Post.objects.count(), initial_posts_count + 1)
+        self.assertEqual(Block.objects.count(), initial_blocks_count + 3)
+
+
 class TestInlineMedia(TestCase):
     fixtures = ['admin-views-users.xml']
 
