diff --git a/django/db/models/base.py b/django/db/models/base.py
index 6077f56..aee136b 100644
a
|
b
|
class Model(object):
|
558 | 558 | if origin and not meta.auto_created: |
559 | 559 | signals.post_save.send(sender=origin, instance=self, |
560 | 560 | created=(not record_exists), raw=raw, using=using) |
561 | | |
| 561 | self._adding = False |
562 | 562 | save_base.alters_data = True |
563 | 563 | |
564 | 564 | def _collect_sub_objects(self, seen_objs, parent=None, nullable=False): |
diff --git a/tests/regressiontests/forms/models.py b/tests/regressiontests/forms/models.py
index a4891df..d2c6c24 100644
a
|
b
|
class Group(models.Model):
|
72 | 72 | def __unicode__(self): |
73 | 73 | return u'%s' % self.name |
74 | 74 | |
| 75 | class Ticket14234(models.Model): |
| 76 | name = models.CharField(max_length=100) |
| 77 | age = models.IntegerField() |
| 78 | description = models.TextField(blank=True) |
| 79 | |
| 80 | def __unicode__(self): |
| 81 | return self.name |
| 82 | |
| 83 | def save(self, *args, **kwargs): |
| 84 | self.full_clean() |
| 85 | return super(Ticket14234, self).save(*args, **kwargs) |
| 86 | |
| 87 | class Ticket14234Form(django_forms.ModelForm): |
| 88 | class Meta: |
| 89 | model = Ticket14234 |
| 90 | |
| 91 | class TestTicket14234(TestCase): |
| 92 | ''' ModelForm.instance._adding should be set to False after ModelForm.save is executed (test for #14234)''' |
| 93 | def test_things(self): |
| 94 | form = Ticket14234Form({ |
| 95 | 'name': 'Fred', |
| 96 | 'age': '56', |
| 97 | 'description': 'Old Fred is 56', |
| 98 | }) |
| 99 | if form.is_valid(): |
| 100 | self.assertEqual(form.instance._adding, True) |
| 101 | obj = form.save() |
| 102 | self.assertEqual(obj._adding, False) |
| 103 | obj.age = 27 |
| 104 | obj.save() # Without the patch we cannot resave |
| 105 | |
75 | 106 | class TestTicket12510(TestCase): |
76 | 107 | ''' It is not necessary to generate choices for ModelChoiceField (regression test for #12510). ''' |
77 | 108 | def setUp(self): |