adding management command to regenerate note slugs
authorCharles Holbrow <charlesholbrow@gmail.com>
Mon, 25 Mar 2013 23:51:52 +0000 (19:51 -0400)
committerCharles Holbrow <charlesholbrow@gmail.com>
Mon, 25 Mar 2013 23:51:52 +0000 (19:51 -0400)
karmaworld/apps/notes/management/commands/regen_note_slugs.py [new file with mode: 0644]

diff --git a/karmaworld/apps/notes/management/commands/regen_note_slugs.py b/karmaworld/apps/notes/management/commands/regen_note_slugs.py
new file mode 100644 (file)
index 0000000..56b801a
--- /dev/null
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+# -*- coding:utf8 -*-
+# Copyright (C) 2012  FinalsClub Foundation
+
+from django.core.management.base import BaseCommand
+from apps.notes.models import Note
+
+class Command(BaseCommand):
+    args = 'none'
+    help = "regenerate all note slugs"
+
+    def handle(self, *args, **kwargs):
+        notes = Note.objects.fall()
+        for n in notes:
+            n.slug = None
+            n.save()
+