def resolve(self, query, **kwargs): if self._key != "co": return query alias = query.get_model_alias(TaskComponent.get_modelname()) if alias is None: query.model(TaskComponent.get_modelname(), alias="c", join="inner", on="a.uid=b.task_id") query.filter("b.component_id =", self._value) return query
def delete_taskcomponents(self, modifier_id, task_id=None, component_id=None): if task_id is None and component_id is None: raise CoreError("the task_id and component_id can't be None at the same time.") query = TaskComponent.all() if task_id is not None: query.filter("task_id =", task_id) if component_id is not None: query.filter("component_id =", component_id) return query.delete(modifier_id)
def fetch_taskcomponents(self, task_id): query = TaskComponent.all() query.filter("task_id =", task_id) return query.fetch()
def has_taskcomponent(self, task_id, component_id): query = TaskComponent.all() query.filter("task_id =", task_id) query.filter("component_id =", component_id) return query.count() > 0
def delete_taskcomponent(self, task_id , component_id, modifier_id): query = TaskComponent.all() query.filter("task_id =", task_id) query.filter("component_id =", component_id) query.delete(modifier_id)