summaryrefslogtreecommitdiff
path: root/app/backend/generate_cal_urls.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/backend/generate_cal_urls.py')
-rw-r--r--app/backend/generate_cal_urls.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/backend/generate_cal_urls.py b/app/backend/generate_cal_urls.py
new file mode 100644
index 0000000..a79f9d0
--- /dev/null
+++ b/app/backend/generate_cal_urls.py
@@ -0,0 +1,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()