def create_announcement(message, url_regex="", can_dismiss=True): with DBSession() as session: announcement = Announcement.create( { "uid": current_user.id, "url_regex": url_regex, "can_dismiss": can_dismiss, "message": message, }, session=session, ) announcement_dict = announcement.to_dict_admin() return announcement_dict
def create_announcement( message, url_regex="", can_dismiss=True, active_from=None, active_till=None, ): with DBSession() as session: announcement = Announcement.create( { "uid": current_user.id, "url_regex": url_regex, "can_dismiss": can_dismiss, "message": message, "active_from": active_from, "active_till": active_till, }, session=session, ) announcement_dict = announcement.to_dict_admin() return announcement_dict