Skip to content

Commit

Permalink
Add keys(), __contains__ method
Browse files Browse the repository at this point in the history
  • Loading branch information
miggland authored Jul 25, 2023
1 parent 64f226e commit d371806
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions inventree/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ def reload(self):
else:
raise AttributeError(f"model.reload failed at '{self._url}': No API instance provided")

def keys(self):
return self._data.keys()

def __contains__(self, name):
return name in self._data

def __getattr__(self, name):

if name in self._data.keys():
Expand Down

0 comments on commit d371806

Please sign in to comment.