def get_pk_value_on_save(self, instance):
        """Generate ID if required."""
        value = super(AleaIdField, self).get_pk_value_on_save(instance)
        if not value:
            value = self.get_seeded_value(instance)
        return value
Generate ID if required.