We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d7c8465 commit 6259df7Copy full SHA for 6259df7
project/ndaparser/models.py
@@ -20,10 +20,17 @@ def get_sentinel_user():
20
21
def datestamped_and_normalized(instance, filename):
22
"""Normalized filename and places in datestamped path"""
23
+ file_parts = filename.split('.')
24
+ if len(file_parts) > 1:
25
+ name = '.'.join(file_parts[:-1])
26
+ ext = '.' + file_parts[-1]
27
+ else:
28
+ ext = ''
29
+ name = filename
30
filename_normalized = unicodeslugify.slugify(
- filename, only_ascii=True, lower=True,
31
+ name, only_ascii=True, lower=True,
32
spaces=False, space_replacement='_'
- )
33
+ ) + ext
34
return datetime.datetime.now().strftime("ndaparser/%Y/%m/%d/{}").format(filename_normalized)
35
36
0 commit comments