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

This commit is contained in:
Alex 2017-05-19 06:40:43 -04:00 committed by Tim Graham
parent 385cf7091e
commit 37ab3c3f9d
5 changed files with 38 additions and 5 deletions

View file

@ -32,6 +32,18 @@ class Thing(models.Model):
name = models.CharField(max_length=255)
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)