Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only one level of subfolder for upload_subfolder #30

Open
gregoriopellegrino opened this issue Feb 28, 2019 · 1 comment
Open

Only one level of subfolder for upload_subfolder #30

gregoriopellegrino opened this issue Feb 28, 2019 · 1 comment

Comments

@gregoriopellegrino
Copy link

Hi, there,
I set my function to define the subfolder like this:

def subfolder(instance):
    return os.path.join("files", str(instance.Publisher.id), str(instance.Contract.id))

But when I upload a file I only find one level of subfolder:

contracts1/10/contract.pdf

It should be:

contracts/1/10/contract.pdf

Thanks,
Gregorio

@rond5137
Copy link

rond5137 commented Jul 15, 2019

@gregoriopellegrino

in source code i found this:
if upload_subfolder: # Should return a list, so joining can be done in a storage-specific manner.

try this:
def subfolder(instance): return ['files', str(instance.Publisher.id), str(instance.Contract.id)]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants