home
·
contact
·
privacy
projects
/
plomtask
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactor BaseModel sorting from GET handlers into class definitions.
[plomtask]
/
plomtask
/
conditions.py
diff --git
a/plomtask/conditions.py
b/plomtask/conditions.py
index b60d0af53c534c4672241bb8f853c3f537d55ecb..15dcb9df623c60378485632ce3bebc4c30f03d47 100644
(file)
--- a/
plomtask/conditions.py
+++ b/
plomtask/conditions.py
@@
-12,6
+12,8
@@
class Condition(BaseModel[int]):
to_save_versioned = ['title', 'description']
to_search = ['title.newest', 'description.newest']
can_create_by_id = True
to_save_versioned = ['title', 'description']
to_search = ['title.newest', 'description.newest']
can_create_by_id = True
+ sorters = {'is_active': lambda c: c.is_active,
+ 'title': lambda c: c.title.newest}
def __init__(self, id_: int | None, is_active: bool = False) -> None:
super().__init__(id_)
def __init__(self, id_: int | None, is_active: bool = False) -> None:
super().__init__(id_)