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

django %Y/%m/%d ? #46

Open
jet10000 opened this issue Oct 29, 2022 · 3 comments
Open

django %Y/%m/%d ? #46

jet10000 opened this issue Oct 29, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@jet10000
Copy link

jet10000 commented Oct 29, 2022

Does it support django's %Y/%m/%d ?

@jet10000 jet10000 changed the title Y-m-d? django %Y/%m/%d ? Oct 29, 2022
@codingjoe
Copy link
Owner

Hi @jet10000 thanks for reaching out. Currently it doesn't, but it's an excellent idea! That could be a great addition. Would you like to contribute it yourself or should I give it a go? Cheers,
Joe

@codingjoe codingjoe added the enhancement New feature or request label Oct 29, 2022
@mustermannalex
Copy link

Hi there,

I'm currently working on adding the date feature and wanted to know what the current state of this implementation is. I'm implementing this feature for now and would appreciate some input on specifying the format type. I'm planning to use the following string formats supported by Python's datetime.strftime:

"%Y" "%m" "%d" "%H:%M:%S" "%m/%d/%Y, %H:%M:%S"

Should the format look something like this?

upload_pattern = FilePattern(filename_pattern='{model_name:.30}/{instance.system_manufacturer.pk}/{timestamp:%m/%d/%Y, %H:%M:%S}-{uuid:base32}{ext}')

Especially for {timestamp:%m/%d/%Y, %H:%M:%S}, I'm unsure how this should work because in the format_field function, there is no type information for the argument.

Any ideas on how to handle this? Maybe using a prefix or some other convention? I'd appreciate any suggestions!

@codingjoe
Copy link
Owner

Sorry that I caused so much confusion here. You can't use Django's date formatting. But you CAN use Python's native one. I expanded the docs to showcase how it's done.

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

No branches or pull requests

3 participants