Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

coercing to Unicode: need string or buffer, StringUUID found #13

Open
sindresorhus opened this Issue · 1 comment

3 participants

@sindresorhus

Why do I need to wrap the field in unicode() to make it usable?

unicode(self.order_id)

If I don't I get:

coercing to Unicode: need string or buffer, StringUUID found

This makes it impossible to use in eg. the modellist without wrapping it in a method.

@fomojola

This was actually a significant issue for me when I performed an upgrade. I ended up doing this:

class CustomUUIDField(UUIDField):
def to_python(self, value):
val = super(CustomUUIDField, self).to_python(value)
return str(val)

And then simply using my custom uuid field everywhere instead.

@luto luto added the bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.