diff --git a/django/db/models/base.py b/django/db/models/base.py
index 5f05865..64af5c6 100644
a
|
b
|
class ModelBase(type):
|
252 | 252 | cls.add_to_class(mgr_name, new_manager) |
253 | 253 | |
254 | 254 | def add_to_class(cls, name, value): |
255 | | if hasattr(value, 'contribute_to_class'): |
| 255 | if isinstance(value, property): |
| 256 | setattr(cls, name, None) |
| 257 | elif hasattr(value, 'contribute_to_class'): |
256 | 258 | value.contribute_to_class(cls, name) |
257 | 259 | else: |
258 | 260 | setattr(cls, name, value) |
diff --git a/tests/regressiontests/model_inheritance_regress/models.py b/tests/regressiontests/model_inheritance_regress/models.py
index 811c817..bf4351d 100644
a
|
b
|
class User(models.Model):
|
182 | 182 | class Profile(User): |
183 | 183 | profile_id = models.AutoField(primary_key=True) |
184 | 184 | extra = models.CharField(max_length=30, blank=True) |
| 185 | |
| 186 | |
| 187 | class SomeTestModel(models.Model): |
| 188 | some_field = models.CharField(max_length=100) |
| 189 | |
| 190 | class Meta: |
| 191 | abstract = True |
| 192 | |
| 193 | @property |
| 194 | def other_field(self): |
| 195 | return "[OTHER] %s" % self.some_field |
| 196 | |
| 197 | class OtherModel(SomeTestModel): |
| 198 | other_field = models.CharField(max_length=100) |
| 199 | other_field2 = models.CharField(max_length=100) |
diff --git a/tests/regressiontests/model_inheritance_regress/tests.py b/tests/regressiontests/model_inheritance_regress/tests.py
index 8f741bb..e9cf2d9 100644
a
|
b
|
from .models import (Place, Restaurant, ItalianRestaurant, ParkingLot,
|
13 | 13 | ParkingLot2, ParkingLot3, Supplier, Wholesaler, Child, SelfRefParent, |
14 | 14 | SelfRefChild, ArticleWithAuthor, M2MChild, QualityControl, DerivedM, |
15 | 15 | Person, BirthdayParty, BachelorParty, MessyBachelorParty, |
16 | | InternalCertificationAudit, BusStation, TrainStation, User, Profile) |
| 16 | InternalCertificationAudit, BusStation, TrainStation, User, Profile, SomeTestModel, OtherModel) |
17 | 17 | |
18 | 18 | |
19 | 19 | class ModelInheritanceTest(TestCase): |
| 20 | |
| 21 | def test_16176(self): |
| 22 | # Regression for #16176 |
| 23 | test1 = SomeTestModel(some_field = "hi") |
| 24 | test2 = OtherModel(other_field = "hi") |
| 25 | test3 = OtherModel(other_field2 = "hi") |
| 26 | |
20 | 27 | def test_model_inheritance(self): |
21 | 28 | # Regression for #7350, #7202 |
22 | 29 | # Check that when you create a Parent object with a specific reference |
… |
… |
class ModelInheritanceTest(TestCase):
|
422 | 429 | form = ProfileForm({'username': "user_with_profile", 'extra': "hello"}, |
423 | 430 | instance=p) |
424 | 431 | self.assertTrue(form.is_valid()) |
| 432 | |
| 433 | |