Skip to content

Commit

Permalink
umrad/fields: Allow str as lhs in PathField filters.
Browse files Browse the repository at this point in the history
This permits e.g. File.objects.filter(path='/some/path/here').
Previously it had to be path=Path('/some/path/here').
  • Loading branch information
robert102 committed Dec 12, 2024
1 parent 29f2c22 commit 3485b62
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mibios/umrad/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 3485b62

Please sign in to comment.