upgrade doc in AbstractGet class
parent
fbafc3de84
commit
5641420acd
|
|
@ -2,7 +2,7 @@ from django.db import models
|
||||||
|
|
||||||
class AbstractUtilsCRUD():
|
class AbstractUtilsCRUD():
|
||||||
"""
|
"""
|
||||||
This class have a primary utils for CRUD functionality
|
This class have a primary utilities for CRUD functionality
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
@ -32,11 +32,17 @@ class AbstractUtilsCRUD():
|
||||||
|
|
||||||
|
|
||||||
class AbstractGet(AbstractUtilsCRUD):
|
class AbstractGet(AbstractUtilsCRUD):
|
||||||
|
"""
|
||||||
|
This class have a abstract getOne / getAll / getByParent
|
||||||
|
"""
|
||||||
|
|
||||||
parent_id_field = ''
|
parent_id_field = ''
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getObject(self, objectID):
|
def getObject(self, objectID):
|
||||||
|
"""
|
||||||
|
get one object
|
||||||
|
"""
|
||||||
return self.__getObjectNormal(self, objectID)
|
return self.__getObjectNormal(self, objectID)
|
||||||
|
|
||||||
def __getObjectNormal(self, objectID):
|
def __getObjectNormal(self, objectID):
|
||||||
|
|
@ -45,11 +51,17 @@ class AbstractGet(AbstractUtilsCRUD):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getAllObjects(self):
|
def getAllObjects(self):
|
||||||
|
"""
|
||||||
|
get all objects
|
||||||
|
"""
|
||||||
objectsAll = self.allObjectsDict()
|
objectsAll = self.allObjectsDict()
|
||||||
return HttpResponse(json.dumps(objectsAll))
|
return HttpResponse(json.dumps(objectsAll))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getObjectsByParentID(self, parentID):
|
def getObjectsByParentID(self, parentID):
|
||||||
|
"""
|
||||||
|
get objects by parent id
|
||||||
|
"""
|
||||||
return HttpResponse(self.__getAllByParentID(parentID))
|
return HttpResponse(self.__getAllByParentID(parentID))
|
||||||
|
|
||||||
def __getAllByParentID(self, parentID):
|
def __getAllByParentID(self, parentID):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue