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