Last active
February 9, 2018 06:01
-
-
Save Nipun2016/3ce5a45c505012d7754c89fc221db6a8 to your computer and use it in GitHub Desktop.
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 attachment_upload(instance, filename): | |
"""Stores the attachment in a "per module/appname/primary key" folder""" | |
return 'attachments/{app}_{model}/{pk}/{filename}'.format( | |
app=instance.content_object._meta.app_label, | |
model=instance.content_object._meta.object_name.lower(), | |
pk=instance.content_object.pk, | |
filename=filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment