Created
March 3, 2015 07:07
-
-
Save chibisov/e3d2c1c6660935c67291 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class QuerySet(object): | |
def __init__(self, query=None): | |
self.query = query or {} | |
def _clone(self): | |
return type(self)(query=deepcopy(self.query)) | |
def __getitem__(self, k): | |
if isinstance(k, slice): | |
def all(self): | |
return self._clone() | |
def filter(self, **kwargs): | |
clone = self._clone() | |
clone.query.update(kwargs) | |
return clone | |
def count(self): | |
raise NotImplementedError() | |
def exists(self): | |
raise NotImplementedError() | |
def get(self, *args, **kwargs): | |
raise NotImplementedError() | |
def order_by(self, *field_names): | |
raise NotImplementedError() | |
def distinct(self, *field_names): | |
raise NotImplementedError() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment