def pre_save(self, instance, add):

        # If the `auto_add` option was set, and there is no value
        # on the model instance, then generate a UUID using the given
        # callable.
        if self._auto_add and add and not getattr(instance, self.attname):
            uuid_value = self._auto_add()

            # Save the UUID to the model instance
            setattr(instance, self.attname, uuid_value)
            return uuid_value

        # This is the standard case; just use the superclass logic.
        return super(UUIDField, self).pre_save(instance, add)
If auto is set, generate a UUID at random.
dataset/ETHPy150Open lukesneeringer/django-pgfields/django_pg/models/fields/uuid.py/UUIDField.pre_save