def delete(self): """ Deletes the current instance """ obj = session.delete(self) session.commit() return obj
def update(self, *args, **kwargs): """ Updates direct against the database """ obj = session.update(self, *args, **kwargs) session.commit() return obj
def save(self): """ Save the current instance. We force a flush so it mimics Django's behavior. """ if self.pk is None: obj = session.save(self) session.commit() else: obj = self.update() return obj