dcramer / django-uuidfield

A UUIDField for Django
BSD 3-Clause "New" or "Revised" License
262 stars 115 forks source link

Fix get_db_prep_value() with Unicode values, Python 2 and 3 #44

Open ghost opened 10 years ago

ghost commented 10 years ago

Corrects issue where UUID value is a Unicode string for database lookup in UUIDField.get_db_prep_value(), compatible with Python 2 and 3.

LordGaav commented 9 years ago

+1, just tested this and this fixes our issue.

I encountered a similar issue and could test it reliably using the sqlite testsuite and these lines at the end of test_hyphenated:

        obj = HyphenatedUUIDField.objects.get(uuid=unicode(obj.uuid))

        self.assertTrue(obj.uuid, uuid)
        self.assertTrue(obj.name, 'shoe')