Created
August 27, 2010 17:42
-
-
Save justquick/553795 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| from django.conf import settings | |
| from django.db.models import get_models, FileField | |
| from django.core.files.storage import get_storage_class | |
| STORAGE = get_storage_class(getattr(settings, "STORAGE", settings.DEFAULT_FILE_STORAGE)) | |
| for model in get_models(): | |
| for field in model._meta.fields: | |
| if isinstance(field, FileField) and not isinstance(field.storage, STORAGE): | |
| FileField(verbose_name=field.verbose_name, upload_to=field.upload_to, name=field.name).\ | |
| contribute_to_class(model, field.name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment