upgrade AbstractGet class
parent
1b1c7d50fa
commit
fbafc3de84
|
|
@ -33,6 +33,8 @@ class AbstractUtilsCRUD():
|
||||||
|
|
||||||
class AbstractGet(AbstractUtilsCRUD):
|
class AbstractGet(AbstractUtilsCRUD):
|
||||||
|
|
||||||
|
parent_id_field = ''
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getObject(self, objectID):
|
def getObject(self, objectID):
|
||||||
return self.__getObjectNormal(self, objectID)
|
return self.__getObjectNormal(self, objectID)
|
||||||
|
|
@ -47,11 +49,12 @@ class AbstractGet(AbstractUtilsCRUD):
|
||||||
return HttpResponse(json.dumps(objectsAll))
|
return HttpResponse(json.dumps(objectsAll))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getObjectsByParentID(self, request, parentID):
|
def getObjectsByParentID(self, parentID):
|
||||||
return HttpResponse(self.getAllByParentID(parentID))
|
return HttpResponse(self.__getAllByParentID(parentID))
|
||||||
|
|
||||||
def __getAllByParentID(self, parentID):
|
def __getAllByParentID(self, parentID):
|
||||||
list = [ x.toDict() for x in self.objectFactory().__get.objects.filter(subject_id = parentID)]
|
list = [ x.toDict() for x in self.objectFactory()
|
||||||
|
.__get.objects.filter(**{ parent_id_field: parentID })]
|
||||||
return json.dumps(list)
|
return json.dumps(list)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue