def toggle_bookmark(entity_id: int) -> str: if int(entity_id) in current_user.bookmarks: Db.delete_bookmark(current_user.id, entity_id) label = _('bookmark') else: Db.insert_bookmark(current_user.id, entity_id) label = _('bookmark remove') return label
def toggle_bookmark(entity_id: int) -> str: if int(entity_id) in current_user.bookmarks: Db.delete_bookmark(current_user.id, entity_id) return 'bookmark' Db.insert_bookmark(current_user.id, entity_id) return 'bookmark remove'