diff --git a/generalApp/AbstractCRUD.py b/generalApp/AbstractCRUD.py index 90459e8..744b165 100644 --- a/generalApp/AbstractCRUD.py +++ b/generalApp/AbstractCRUD.py @@ -125,9 +125,14 @@ class AbstractCreate(AbstractUtilsCRUD): """ del objectDict['token'] newObject = self._objectFactory().objects.create(**objectDict) + self._setActualTimeTrigger(newObject) newObject.save() return HttpResponse(f"Add new Object: {newObject.toDict()}") + @classmethod + def _setActualTimeTrigger(self, trigger): + pass + @classmethod def addObjectWithParent(self, request, parentID, privilige): """ @@ -150,9 +155,8 @@ class AbstractCreate(AbstractUtilsCRUD): del objectDict['token'] newObject = self._objectFactory().objects.create(**objectDict) - self.__setParentID(parentID) + self._setParentID(parentID) self._createFirstComment(newObject, objectDict) - self._setActualTimeTrigger() newObject.save() return HttpResponse(f"Add new Object: {newObject.toDict()}") @@ -161,10 +165,6 @@ class AbstractCreate(AbstractUtilsCRUD): def _createFirstComment(self, newSubject, objectDict): pass - @classmethod - def _setActualTimeTrigger(self): - pass - class Meta: abstract = True diff --git a/generalApp/__pycache__/AbstractCRUD.cpython-36.pyc b/generalApp/__pycache__/AbstractCRUD.cpython-36.pyc index 90811ea..a8f39aa 100644 Binary files a/generalApp/__pycache__/AbstractCRUD.cpython-36.pyc and b/generalApp/__pycache__/AbstractCRUD.cpython-36.pyc differ diff --git a/generalApp/__pycache__/models.cpython-36.pyc b/generalApp/__pycache__/models.cpython-36.pyc index b7a84e4..84d997c 100644 Binary files a/generalApp/__pycache__/models.cpython-36.pyc and b/generalApp/__pycache__/models.cpython-36.pyc differ diff --git a/generalApp/models.py b/generalApp/models.py index 4687db8..af7dc81 100755 --- a/generalApp/models.py +++ b/generalApp/models.py @@ -400,9 +400,10 @@ class Triggers(AbstractCRUD): return Triggers # Create Trigger (set actual time) - - def _setActualTimeTrigger(self): - self.date_of_trigger = str(datetime.now().strftime("%Y-%d-%m %H:%M")) + + @classmethod + def _setActualTimeTrigger(self, trigger): + trigger.date_of_trigger = str(datetime.now().strftime('%Y-%d-%m %H:%M')) class Notifications(AbstractCRUD):