]> git.ozlabs.org Git - patchwork/blobdiff - apps/patchwork/models.py
Support postgresql_psycopg2 DATABASE_ENGINE
[patchwork] / apps / patchwork / models.py
index 6d331f325785b4ef0eebeb1a65eac0b12c3e7e2e..11457d76bdf9a0e14524b425dbc483b41d8f083c 100644 (file)
@@ -194,10 +194,13 @@ class HashField(models.Field):
             n_bytes = len(hashlib.new(self.algorithm).digest())
         else:
             n_bytes = len(self.hash_constructor().digest())
-        if settings.DATABASE_ENGINE == 'postgresql':
+        if settings.DATABASE_ENGINE.startswith('postgresql'):
             return 'bytea'
         elif settings.DATABASE_ENGINE == 'mysql':
             return 'binary(%d)' % n_bytes
+        else:
+            raise Exception("Unknown database engine '%s'" % \
+                            settings.DATABASE_ENGINE)
 
     def to_python(self, value):
         return value