adding convenience filter methods

This commit is contained in:
Blake Eggleston
2012-12-04 22:46:44 -08:00
parent 43cbca139d
commit eb28b92dcf

View File

@@ -75,6 +75,18 @@ class BaseModel(object):
@classmethod
def create(cls, **kwargs):
return cls.objects.create(**kwargs)
@classmethod
def all(cls):
return cls.objects.all()
@classmethod
def filter(cls, **kwargs):
return cls.objects.filter(**kwargs)
@classmethod
def get(cls, **kwargs):
return cls.objects.get(**kwargs)
def save(self):
is_new = self.pk is None