from slugify import slugify from rcal.db import Session from rcal.model import Calendar def main(): session = Session.create() for calendar in session.query(Calendar).all(): calendar.custom_url = slugify( calendar.custom_name if calendar.custom_name else calendar.name) session.commit() if __name__ == '__main__': main()