Created
August 26, 2012 10:53
-
-
Save yakky/3477426 to your computer and use it in GitHub Desktop.
Migration script for django-filer pre 0.9a3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Import and execute the function