mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #28222 -- Allowed settable properties in QuerySet.update_or_create()/get_or_create() defaults.
This commit is contained in:
parent
385cf7091e
commit
37ab3c3f9d
5 changed files with 38 additions and 5 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue