Skip to content

Instantly share code, notes, and snippets.

@yakky
Created August 26, 2012 10:53
Show Gist options
  • Save yakky/3477426 to your computer and use it in GitHub Desktop.
Save yakky/3477426 to your computer and use it in GitHub Desktop.
Migration script for django-filer pre 0.9a3
def fix_dev_path():
from filer.models import File
import sys
for f in File.objects.filter(is_public=True):
sys.stdout.write(u'moving %s to public storage... ' % f.id)
f.is_public = False
f.file.name = "filer/%s" % f.file.name
f.save()
f.is_public = True
f.save()
sys.stdout.write(u'done\n')
for f in File.objects.filter(is_public=False):
sys.stdout.write(u'moving %s to private storage... ' % f.id)
f.is_public = True
f.file.name = "filer/%s" % f.file.name
f.save()
f.is_public = False
f.save()
sys.stdout.write(u'done\n')
@yakky
Copy link
Author

yakky commented Aug 26, 2012

To fix django-filer pre-0.9a3 paths you can copy this file in the project dir and execute the following commands

Enter the django shell

$: python manage.py shell

Import and execute the function

>>> from fix import fix_dev_path
>>> fix_dev_path()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment