diff --git a/AUTHORS b/AUTHORS
index a32e0d6..5c794c4 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -342,6 +342,7 @@ answer newbie questions, and generally made Django that much better:
     mattycakes@gmail.com
     Glenn Maynard <glenn@zewt.org>
     Jason McBrayer <http://www.carcosa.net/jason/>
+    Kevin McCarthy <me@kevinmccarthy.org>
     Kevin McConnell <kevin.mcconnell@gmail.com>
     mccutchen@gmail.com
     michael.mcewan@gmail.com
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index c603210..8c3604f 100644
--- a/django/contrib/admin/options.py
+++ b/django/contrib/admin/options.py
@@ -942,6 +942,7 @@ class ModelAdmin(BaseModelAdmin):
             'errors': helpers.AdminErrorList(form, formsets),
             'root_path': self.admin_site.root_path,
             '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
index b32f76d..088e458 100644
--- a/django/contrib/admin/templates/admin/change_form.html
+++ b/django/contrib/admin/templates/admin/change_form.html
@@ -63,6 +63,8 @@
 
 {% 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
index ee0abd1..3101029 100644
--- a/tests/regressiontests/admin_inlines/models.py
+++ b/tests/regressiontests/admin_inlines/models.py
@@ -191,3 +191,21 @@ class NovelAdmin(admin.ModelAdmin):
 
 admin.site.register(Poll, PollAdmin)
 admin.site.register(Novel, NovelAdmin)
+
+# Models for #13223
+class Post(models.Model):
+    title = models.CharField(max_length=200)
+    slug = models.CharField(max_length=200, unique = True)
+
+class Block(models.Model):
+    post = models.ForeignKey(Post)
+    slug = models.CharField(max_length=200, unique = True)
+
+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
index 067b3c5..73b1990 100644
--- a/tests/regressiontests/admin_inlines/tests.py
+++ b/tests/regressiontests/admin_inlines/tests.py
@@ -4,7 +4,8 @@ from django.test import TestCase
 
 # 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,
+    Block, Post)
 
 
 class TestInline(TestCase):
@@ -103,6 +104,53 @@ class TestInline(TestCase):
         # column cells
         self.assertContains(response, '<p>Callable in QuestionInline</p>')
 
+    def test_inline_save_as(self):
+        """
+        #13223 - ValueError with inline and save as new.
+        Verifies that _saveasnew is included in the form when it is
+        rendered due to validation errors.
+        """
+
+        p = Post.objects.create(title='test', slug='test')
+        b1 = p.block_set.create(slug='test1')
+        b2 = p.block_set.create(slug='test2')
+        b3 = p.block_set.create(slug='test3')
+
+        data = {
+            'block_set-TOTAL_FORMS': 6,
+            'block_set-INITIAL_FORMS': 3,
+            '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': b2.id,
+            'block_set-2-post': p.id,
+            'block_set-2-slug': b2.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-5-id': '',
+            'block_set-5-post': p.id,
+            'block_set-5-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)
+        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">')
+
+
+
 class TestInlineMedia(TestCase):
     fixtures = ['admin-views-users.xml']
 
