changeset 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 dcd097a59223
children 8cf024410042
files band/management/commands/untextile.py madeira/settings/base.py madeira/templates/band/photo_detail.html madeira/templates/index.html
diffstat 4 files changed, 21 insertions(+), 4 deletions(-) [+]
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()
--- a/madeira/settings/base.py	Wed Aug 28 19:00:43 2013 -0500
+++ b/madeira/settings/base.py	Wed Aug 28 19:22:23 2013 -0500
@@ -95,7 +95,6 @@
     'django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.flatpages',
-    'django.contrib.markup',
     'django.contrib.messages',
     'django.contrib.sessions',
     'django.contrib.sites',
--- a/madeira/templates/band/photo_detail.html	Wed Aug 28 19:00:43 2013 -0500
+++ b/madeira/templates/band/photo_detail.html	Wed Aug 28 19:22:23 2013 -0500
@@ -1,5 +1,4 @@
 {% extends 'base.html' %}
-{% load markup %}
 {% block title %}The Madeira | Photos: {{ gallery.title }}{% endblock %}
 {% block custom_css %}
 <link rel="stylesheet" href="{{ STATIC_URL }}js/fancybox/jquery.fancybox-1.3.1.css" type="text/css" media="screen" />
@@ -15,7 +14,7 @@
 {% endblock %}
 {% block content %}
 <h1>Madeira Photos: {{ gallery.title }}</h1>
-{{ gallery.description|textile }}
+{{ gallery.description|safe }}
 
 <div class="madeira-photo-list">
 {% for photo in photos %}
--- a/madeira/templates/index.html	Wed Aug 28 19:00:43 2013 -0500
+++ b/madeira/templates/index.html	Wed Aug 28 19:22:23 2013 -0500
@@ -13,7 +13,6 @@
 });
 </script>
 {% endblock %}
-{% load markup %}
 {% block content %}
 <h1>The Madeira</h1>
 <img class="floatLeftBox" src="/media/photologue/photos/2008/Apr/20/band2008.jpg"