diff --git a/django/db/models/base.py b/django/db/models/base.py index 67d1ec974c160..99c6cea86288f 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -268,7 +268,7 @@ def save(self, raw=False, cls=None): self.save(raw, parent) setattr(self, field.attname, self._get_pk_val(parent._meta)) - non_pks = [f for f in self._meta.local_fields if not f.primary_key] + non_pks = [f for f in meta.local_fields if not f.primary_key] # First, try an UPDATE. If that doesn't update anything, do an INSERT. pk_val = self._get_pk_val(meta) diff --git a/tests/modeltests/model_inheritance/models.py b/tests/modeltests/model_inheritance/models.py index 988edefa9cf1a..d6ff586ee328e 100644 --- a/tests/modeltests/model_inheritance/models.py +++ b/tests/modeltests/model_inheritance/models.py @@ -128,7 +128,9 @@ def __unicode__(self): >>> r.save() # Test the constructor for ItalianRestaurant. ->>> ir = ItalianRestaurant(name='Ristorante Miron', address='1234 W. Elm', serves_hot_dogs=False, serves_pizza=False, serves_gnocchi=True, rating=4) +>>> ir = ItalianRestaurant(name='Ristorante Miron', address='1234 W. Ash', serves_hot_dogs=False, serves_pizza=False, serves_gnocchi=True, rating=4) +>>> ir.save() +>>> ir.address = '1234 W. Elm' >>> ir.save() # Make sure Restaurant and ItalianRestaurant have the right fields in the right