django_rbac: always prevent empty uuid (#31083)

This commit is contained in:
Valentin Deniaud 2019-10-08 16:03:19 +02:00
parent 5b8b62a19f
commit 9159c4d70b
1 changed files with 2 additions and 0 deletions

View File

@ -57,6 +57,8 @@ class AbstractBase(models.Model):
if len(self.slug) > 256:
self.slug = self.slug[:252] + \
hashlib.md5(self.slug).hexdigest()[:4]
if not self.uuid:
self.uuid = utils.get_hex_uuid()
return super(AbstractBase, self).save(*args, **kwargs)
def natural_key(self):