From 3485b625a45da5eca4494d5067e0ff60ee3631b2 Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 12 Dec 2024 16:53:12 -0500 Subject: [PATCH] umrad/fields: Allow str as lhs in PathField filters. This permits e.g. File.objects.filter(path='/some/path/here'). Previously it had to be path=Path('/some/path/here'). --- mibios/umrad/fields.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mibios/umrad/fields.py b/mibios/umrad/fields.py index 26950d2..eede8e7 100644 --- a/mibios/umrad/fields.py +++ b/mibios/umrad/fields.py @@ -193,6 +193,8 @@ def get_prep_value(self, value): elif self.root is None: return str(value) else: + if not isinstance(value, Path): + value = Path(value) return str(value.relative_to(self.root)) def value_to_string(self, obj):