summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-05-03 22:10:39 +0200
committeremkael <emkael@tlen.pl>2016-05-04 10:05:37 +0200
commitbb11fd7a0d1f24ac145523a84cb3123b2e0ab57f (patch)
treebd01f009dec9afd82c39dca7dc3b6b27423bde0a /app
parent0c6e3ee216b30acfca4e3b0fab0b085b8e34960b (diff)
* generating URLs for calendars
Diffstat (limited to 'app')
-rw-r--r--app/python/generate_cal_urls.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/python/generate_cal_urls.py b/app/python/generate_cal_urls.py
new file mode 100644
index 0000000..4546b5c
--- /dev/null
+++ b/app/python/generate_cal_urls.py
@@ -0,0 +1,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()