﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33993	Allow instance to be passed into the FileField storage callable param	Viicos	nobody	"A while ago [https://code.djangoproject.com/ticket/28184/ #28184] introduced the ability to use callables as the `storage` parameter of the `FileField`.

Someone even requested the ability to have the instance passed into the callable: https://github.com/django/django/pull/8477/files#r226555624

But I believe @miigotu misinterpreted it and was thinking about a `Storage` instance.

What could be great is the ability to pass the instance (and maybe the filename too) similar to [https://docs.djangoproject.com/en/4.1/ref/models/fields/#django.db.models.FileField.upload_to/ upload_to]

Example:


{{{
#!python
def get_storage(instance, filename):
    if instance.is_private:
        return PrivateStorage()
    else:
        ...
}}}

This could allow the user to use a specific storage depending on the instance being saved.
"	New feature	new	File uploads/storage	dev	Normal		callable, storage, filefield		Unreviewed	0	0	0	0	0	0
