Mercurial > public > madeira
annotate band/management/commands/untextile.py @ 130:3062c547bb90
For Django 1.6: new test discovery plus reverse now does urlquote().
My base64 keys were padded with '=' and these got quoted when doing
a reverse to generate the URL. So changed the test to look for a
quoted version of the key. This will change the URLs sent to users, but
I believe it will all be taken care of by Django.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 24 Dec 2013 16:47:27 -0600 |
parents | 7b52e8ef01ec |
children |
rev | line source |
---|---|
bgneal@95 | 1 """ |
bgneal@95 | 2 untextile.py - A command to remove the use of Textile by updating the models. |
bgneal@95 | 3 |
bgneal@95 | 4 """ |
bgneal@95 | 5 import textile |
bgneal@95 | 6 |
bgneal@95 | 7 from django.core.management.base import NoArgsCommand |
bgneal@95 | 8 from photologue.models import Gallery |
bgneal@95 | 9 |
bgneal@95 | 10 |
bgneal@95 | 11 class Command(NoArgsCommand): |
bgneal@95 | 12 help = 'Updates models by un-textiling text fields' |
bgneal@95 | 13 |
bgneal@95 | 14 def handle_noargs(self, **options): |
bgneal@95 | 15 |
bgneal@95 | 16 for gallery in Gallery.objects.all(): |
bgneal@95 | 17 gallery.description = textile.textile(gallery.description, |
bgneal@95 | 18 encoding='utf-8', |
bgneal@95 | 19 output='utf-8') |
bgneal@95 | 20 gallery.save() |