1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

[1.11.x] Fixed #28222 -- Allowed settable properties in QuerySet.update_or_create()/get_or_create() defaults.

Backport of 37ab3c3f9d from master
This commit is contained in:
Alex
2017-05-19 06:40:43 -04:00
committed by Tim Graham
parent f804b46294
commit b9abdd92ab
5 changed files with 38 additions and 5 deletions

View File

@@ -36,6 +36,18 @@ class Thing(models.Model):
name = models.CharField(max_length=256)
tags = models.ManyToManyField(Tag)
@property
def capitalized_name_property(self):
return self.name
@capitalized_name_property.setter
def capitalized_name_property(self, val):
self.name = val.capitalize()
@property
def name_in_all_caps(self):
return self.name.upper()
class Publisher(models.Model):
name = models.CharField(max_length=100)