mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Refs #33476 -- Reformatted code with Black.
This commit is contained in:
committed by
Mariusz Felisiak
parent
f68fa8b45d
commit
9c19aff7c7
@@ -21,15 +21,14 @@ class MyWrapper:
|
||||
|
||||
|
||||
class MyWrapperField(models.CharField):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
kwargs['max_length'] = 10
|
||||
kwargs["max_length"] = 10
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def pre_save(self, instance, add):
|
||||
value = getattr(instance, self.attname, None)
|
||||
if not value:
|
||||
value = MyWrapper(''.join(random.sample(string.ascii_lowercase, 10)))
|
||||
value = MyWrapper("".join(random.sample(string.ascii_lowercase, 10)))
|
||||
setattr(instance, self.attname, value)
|
||||
return value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user