def query(self, value, prefix=None): if not value is None: lookup_type, lookup_value = value lookup_fieldname = self.model_field.get_attname() if not prefix is None: lookup_fieldname = prefix + '__' + lookup_fieldname from models import UncertainDateTimeField as UncertainDateTimeModelField if lookup_type == 'maybe_during': return UncertainDateTimeModelField.get_maybe_sametime_q(lookup_value, lookup_fieldname) elif lookup_type == 'maybe_before': return UncertainDateTimeModelField.get_maybe_before_q(lookup_value, lookup_fieldname) elif lookup_type == 'maybe_after': return UncertainDateTimeModelField.get_maybe_after_q(lookup_value, lookup_fieldname) elif lookup_type == 'maybe_between': q = UncertainDateTimeModelField.get_maybe_after_q(lookup_value[0], lookup_fieldname) q &= UncertainDateTimeModelField.get_maybe_before_q(lookup_value[1], lookup_fieldname) return q elif lookup_type == 'before': return UncertainDateTimeModelField.get_definite_before_q(lookup_value, lookup_fieldname) elif lookup_type == 'after': return UncertainDateTimeModelField.get_definite_after_q(lookup_value, lookup_fieldname) elif lookup_type == 'between': q = UncertainDateTimeModelField.get_definite_after_q(lookup_value[0], lookup_fieldname) q &= UncertainDateTimeModelField.get_definite_before_q(lookup_value[1], lookup_fieldname) return q return Q()