forked from ringolove/Acachu-Cafe-Recommendations-System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathacachu_utils.py
42 lines (26 loc) · 1.03 KB
/
acachu_utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import os
from datetime import datetime
def rename_abimagefile(instance, filename):
upload_to = f'media/ab_images/'
ext = filename.split('.')[-1]
current_time = datetime.now()
filename ='{}.{}'.format(current_time, ext)
return os.path.join(upload_to, filename)
def rename_cafeimagefile(instance, filename):
upload_to = f'media/cafe_images/'
ext = filename.split('.')[-1]
current_time = datetime.now()
filename ='{}.{}'.format(current_time, ext)
return os.path.join(upload_to, filename)
def rename_imagefile(instance, filename):
upload_to = f'media/images/'
ext = filename.split('.')[-1]
current_time = datetime.now()
filename ='{}.{}'.format(current_time, ext)
return os.path.join(upload_to, filename)
def rename_searchimagefile(instance, filename):
upload_to = f'media/search_images/'
ext = filename.split('.')[-1]
current_time = datetime.now()
filename ='{}.{}'.format(current_time, ext)
return os.path.join(upload_to, filename)