def update_serial(self, serial: Serial): if not serial: return None serial.save() # self._settings.refresh_from_db(['series']) self._notify_serial_updated(serial)
def update_entry(self, serial: Serial): serial.name = self.name.data serial.group = self.group.data serial.description = self.description.data serial.season = self.season.data serial.visible = self.visible.data return serial
def make_serial(self) -> Serial: return Serial()
def _notify_serial_removed(self, serial: Serial): self.__notify_front(Service.SERIAL_REMOVED, serial.to_front_dict())
def _notify_serial_updated(self, serial: Serial): self.__notify_front(Service.SERIAL_UPDATED, serial.to_front_dict())
def _notify_serial_added(self, serial: Serial): self.__notify_front(Service.SERIAL_ADDED, serial.to_front_dict())
def remove_serial(self, sid: ObjectId): serial = Serial.get_by_id(sid) if serial: self._settings.remove_serial(serial) self._settings.save() self._notify_serial_removed(serial)
def make_entry(self): return self.update_entry(Serial())