Skip to content

Commit

Permalink
Merge pull request #29 from boostbob/master
Browse files Browse the repository at this point in the history
add __getitem__ to ModelBase for [] call syntax
  • Loading branch information
kiddouk committed Jun 6, 2016
2 parents a8b622d + 62d6655 commit 1488908
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -10,3 +10,4 @@ dump.rdb
/.pyflymakercc
/.emacs.desktop
/redisco/.ropeproject/config.py
.ropeproject
2 changes: 2 additions & 0 deletions redisco/models/base.py
Expand Up @@ -217,6 +217,8 @@ def __init__(cls, name, bases, attrs):
att._target_type = cls
_initialize_referenced(model_class, att)

def __getitem__(self, id):
return self.objects.get_by_id(id)

class Model(object):
__metaclass__ = ModelBase
Expand Down

0 comments on commit 1488908

Please sign in to comment.