summaryrefslogtreecommitdiff
path: root/app/backend/generate_cal_urls.py
blob: a79f9d08e006eae897a5160e30dfd6c92b5f1828 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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()