Skip to content

Commit

Permalink
Jan's ActionSkel dream...
Browse files Browse the repository at this point in the history
Requires diwodo viur-core editable to work properly.
  • Loading branch information
phorward committed Sep 24, 2024
1 parent 9278603 commit c67279d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ verify_ssl = true
name = "pypi"

[packages]
viur-core = "==3.7.0.dev3"
viur-core = {file = "../viur-core", editable = true}

[dev-packages]
viur-cli = "~=2.0"
Expand Down
11 changes: 4 additions & 7 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 10 additions & 12 deletions deploy/modules/todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,18 @@ class TodoAssignSkel(ActionSkel):
action_skel.setBoneValue("todo", key, append=True)

if not kwargs or not action_skel.fromClient(kwargs):
# TODO: Provide generic render action skel
return self.render.edit(action_skel, "assign")
return self.render.render("assign", action_skel)

# TODO: Add program logic here
# TODO: Create skel.update() function for transactional in-place update
for todo in action_skel["todo"]:
skel = self.editSkel()
skel.fromDB(todo["dest"]["key"])
skel["status"] = "open"
skel.setBoneValue("user", action_skel["user"]["dest"]["key"])
skel.toDB()

# TODO: Provide generic render action success
return self.render.editSuccess(action_skel, "assignSuccess")
self.editSkel().update(
values={
"status": "open",
"user": action_skel["user"]["dest"]["key"],
},
key=todo["dest"]["key"],
)

return self.render.render("assignSuccess", action_skel)

def listFilter(self, query):
if query := super().listFilter(query):
Expand Down
2 changes: 1 addition & 1 deletion deploy/skeletons/todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class TodoSkel(skeleton.Skeleton):
status = SelectBone(
descr="Status",
required=True,
defaultValue="open",
defaultValue="new",
values={
"new": "Neu",
"open": "Zugewiesen",
Expand Down

0 comments on commit c67279d

Please sign in to comment.