From: Charles Holbrow Date: Mon, 25 Mar 2013 23:51:52 +0000 (-0400) Subject: adding management command to regenerate note slugs X-Git-Tag: release-20150131~466 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3e57386cb22aafd0dc8acede47fc0ed34017f352;p=oweals%2Fkarmaworld.git adding management command to regenerate note slugs --- 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 index 0000000..56b801a --- /dev/null +++ b/karmaworld/apps/notes/management/commands/regen_note_slugs.py @@ -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() +