1. Waldemar Kornewald
  2. djangotoolbox

Source

djangotoolbox / djangotoolbox / fields.py

Diff from to

File djangotoolbox/fields.py

         return self._convert(self.item_field.get_db_prep_save,
                              value, connection=connection)
 
+    # TODO/XXX: Remove this once we have a cleaner solution
+    def get_db_prep_lookup(self, lookup_type, value, connection, prepared=False):
+        if hasattr(value, 'as_lookup_value'):
+            value = value.as_lookup_value(self, lookup_type, connection)
+        return value
+
     def validate(self, values, model_instance):
         try:
             iter(values)
                            '_model'  : embedded_instance.__class__.__name__})
         return values
 
+    # TODO/XXX: Remove this once we have a cleaner solution
+    def get_db_prep_lookup(self, lookup_type, value, connection, prepared=False):
+        if hasattr(value, 'as_lookup_value'):
+            value = value.as_lookup_value(self, lookup_type, connection)
+        return value
+
     def to_python(self, values):
         if not isinstance(values, dict):
             return values