mirror of https://github.com/django/django.git
Use a name that exists in both python2 and 3,
This commit is contained in:
parent
e0ec7507ac
commit
c7734491f8
|
@ -31,7 +31,7 @@ class MyAutoField(six.with_metaclass(models.SubfieldBase, models.CharField)):
|
||||||
def pre_save(self, instance, add):
|
def pre_save(self, instance, add):
|
||||||
value = getattr(instance, self.attname, None)
|
value = getattr(instance, self.attname, None)
|
||||||
if not value:
|
if not value:
|
||||||
value = MyWrapper(''.join(random.sample(string.lowercase, 10)))
|
value = MyWrapper(''.join(random.sample(string.ascii_lowercase, 10)))
|
||||||
setattr(instance, self.attname, value)
|
setattr(instance, self.attname, value)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue