diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2012-08-02 15:51:38 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2012-08-02 15:51:38 +0200 |
commit | f73ded3fd8f57d3ea86e1f5c98fc6685b438e71b (patch) | |
tree | 6ce40b52d73567e3ecaf7b53e33511dc67e54bd3 | |
parent | 03827c52a4747f77c7b06f5122b8c4e63e513ccb (diff) | |
download | Chimère-f73ded3fd8f57d3ea86e1f5c98fc6685b438e71b.tar.bz2 Chimère-f73ded3fd8f57d3ea86e1f5c98fc6685b438e71b.zip |
Fix migration script
-rw-r--r-- | chimere/migrations/0012_auto__chg_field_picturefile_name__chg_field_multimediafile_url__chg_fi.py | 5 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | example_project/settings.py | 2 |
3 files changed, 7 insertions, 2 deletions
diff --git a/chimere/migrations/0012_auto__chg_field_picturefile_name__chg_field_multimediafile_url__chg_fi.py b/chimere/migrations/0012_auto__chg_field_picturefile_name__chg_field_multimediafile_url__chg_fi.py index 405009a..b61a375 100644 --- a/chimere/migrations/0012_auto__chg_field_picturefile_name__chg_field_multimediafile_url__chg_fi.py +++ b/chimere/migrations/0012_auto__chg_field_picturefile_name__chg_field_multimediafile_url__chg_fi.py @@ -1,5 +1,6 @@ # encoding: utf-8 import datetime +import os from south.db import db from south.v2 import SchemaMigration from django.db import models @@ -8,6 +9,10 @@ class Migration(SchemaMigration): def forwards(self, orm): + for picturefile in orm.PictureFile.objects.all(): + if not picturefile.name: + picturefile.name = picturefile.picture.filename.split(os.sep)[-1] + picturefile.save() # Changing field 'PictureFile.name' db.alter_column('chimere_picturefile', 'name', self.gf('django.db.models.fields.CharField')(default='Default name', max_length=150)) diff --git a/debian/control b/debian/control index faa9b7c..7317430 100644 --- a/debian/control +++ b/debian/control @@ -4,6 +4,6 @@ Depends: python-django (>=1.3), python-gdal, python-psycopg2, python-beautifulsoup, python-imaging, libjs-jquery, libjs-jquery-ui, libjs-jquery-ui-theme-base, postgresql-9.1, postgresql-9.1-postgis, gettext, - python-simplejson, gpsbabel + python-simplejson, gpsbabel, python-django-south Recommends: tinymce, python-django-celery, python-kombu Suggests: libjs-jquery-ui-theme-south-street diff --git a/example_project/settings.py b/example_project/settings.py index 29c7823..812ca66 100644 --- a/example_project/settings.py +++ b/example_project/settings.py @@ -120,7 +120,7 @@ MEDIA_URL = '/media/' # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. -# Examples: "http://foo.com/media/", "/media/". +# deprecated in Django 1.4 but left for Django 1.3 ADMIN_MEDIA_PREFIX = '/admin-media/' # Make this unique, and don't share it with anybody. |