Skip to content

Instantly share code, notes, and snippets.

@kezabelle
Created April 4, 2014 10:14
Show Gist options
  • Save kezabelle/9971763 to your computer and use it in GitHub Desktop.
Save kezabelle/9971763 to your computer and use it in GitHub Desktop.
django-uuidfield fix to prefetch_related. No idea what else it breaks instead though :|
from django.conf.urls import patterns, include, url
from uuidfield import UUIDField
# Fix the bloody UUID field so that we can do prefetching.
UUIDField._old_to_python = UUIDField.to_python
def maybe_fix_to_python(self, value):
return unicode(UUIDField._old_to_python(self, value=value))
UUIDField.to_python = maybe_fix_to_python
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment