'Existing and new inlines are saved with save_as_new.
Regression for #14938.'

def test_save_as_new_with_new_inlines(self):

    efnet = Network.objects.create(name=u'EFNet')
    host1 = Host.objects.create(hostname=u'irc.he.net', network=efnet)
    HostFormSet = inlineformset_factory(Network, Host, fields=u'__all__')
    data = {u'host_set-TOTAL_FORMS': u'2', u'host_set-INITIAL_FORMS': u'1', u'host_set-MAX_NUM_FORMS': u'0', u'host_set-0-id': six.text_type(host1.id), u'host_set-0-hostname': u'tranquility.hub.dal.net', u'host_set-1-hostname': u'matrix.de.eu.dal.net'}
    dalnet = Network.objects.create(name=u'DALnet')
    formset = HostFormSet(data, instance=dalnet, save_as_new=True)
    self.assertTrue(formset.is_valid())
    formset.save()
    self.assertQuerysetEqual(dalnet.host_set.order_by(u'hostname'), [u'<Host:    matrix.de.eu.dal.net>', u'<Host:    tranquility.hub.dal.net>'])
