from models_ext import BaseModelMixin, upload_file_url, upload_path

Brightcells 7 年之前
父节点
当前提交
135c21b40c
共有 2 个文件被更改,包括 1 次插入17 次删除
  1. 1 13
      operation/models.py
  2. 0 4
      utils/url_utils.py

+ 1 - 13
operation/models.py

@@ -1,22 +1,10 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 
3
-import os
4
-
5 3
 from django.db import models
6 4
 from django.utils.translation import ugettext_lazy as _
7
-from models_ext import BaseModelMixin
8
-from TimeConvert import TimeConvert as tc
5
+from models_ext import BaseModelMixin, upload_file_url, upload_path
9 6
 
10 7
 from pai2.basemodels import PaiaiSrcMixin, PlatformMixin, VersionMixin
11
-from utils.url_utils import upload_file_url
12
-
13
-
14
-def upload_path(instance, old_filename):
15
-    return 'file/{ym}/{stamp}{ext}'.format(
16
-        ym=tc.local_string(format='%Y%m'),
17
-        stamp=tc.local_timestamp(ms=True),
18
-        ext=os.path.splitext(old_filename)[1].lower(),
19
-    )
20 8
 
21 9
 
22 10
 class LatestAppInfo(BaseModelMixin, PaiaiSrcMixin):

+ 0 - 4
utils/url_utils.py

@@ -5,7 +5,3 @@ from django.conf import settings
5 5
 
6 6
 def share_url(photo_id):
7 7
     return '{}/gp/{}'.format(settings.DOMAIN, photo_id) if photo_id else ''
8
-
9
-
10
-def upload_file_url(file_path):
11
-    return file_path and ('{}{}'.format(settings.DOMAIN, file_path.url))