Skip to content

Commit

Permalink
load orm entity in CRUD method
Browse files Browse the repository at this point in the history
fixes #141
  • Loading branch information
guruofgentoo committed Feb 21, 2022
1 parent 6014b64 commit 89bc7d4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion keg_auth/views.py
Expand Up @@ -193,6 +193,9 @@ def add_edit(self, meth, obj=None):
form=form
)

def fetch_orm_obj(self, obj_id):
return self.orm_cls.query.get(obj_id)

def init_object(self, obj_id, action=None):
"""Load record from ORM for edit/delete cases.
Expand All @@ -204,7 +207,7 @@ def init_object(self, obj_id, action=None):
"""
if obj_id is None:
flask.abort(400)
self.objinst = self.orm_cls.query.get(obj_id)
self.objinst = self.fetch_orm_obj(obj_id)
if not self.objinst:
flask.abort(404)
if action:
Expand Down

0 comments on commit 89bc7d4

Please sign in to comment.