Mercurial > public > madeira
diff band/management/commands/untextile.py @ 95:7b52e8ef01ec
For Django 1.5: Remove usage of django.contrib.markup.
Since we were only using Textile in one place, decided to stop using it
altogether.
Wrote a management command, untextile, to convert the gallery models'
description fields from textile to raw HTML. This should be run one time before
going live with Django 1.5.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 28 Aug 2013 19:22:23 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/band/management/commands/untextile.py Wed Aug 28 19:22:23 2013 -0500 @@ -0,0 +1,20 @@ +""" +untextile.py - A command to remove the use of Textile by updating the models. + +""" +import textile + +from django.core.management.base import NoArgsCommand +from photologue.models import Gallery + + +class Command(NoArgsCommand): + help = 'Updates models by un-textiling text fields' + + def handle_noargs(self, **options): + + for gallery in Gallery.objects.all(): + gallery.description = textile.textile(gallery.description, + encoding='utf-8', + output='utf-8') + gallery.save()