38"> 308
+            # 设置群组最后一张照片PK
309
+            r.set(GROUP_LAST_PHOTO_PK % group_id, group_photo.pk)
306 310
 
307
-        # Redis 群组数据缓存
308
-        set_group_info_by_id(group_id)
311
+            # Redis 群组数据缓存
312
+            set_group_info_by_id(group_id)
309 313
 
310 314
     curinfo = get_current_photos(group_id, user_id, group_user.current_id, request=request)
311 315
 

+ 1 - 1
requirements.txt

@@ -9,7 +9,7 @@ TimeConvert==1.3.12
9 9
 cryptography==1.5.2
10 10
 django-curtail-uuid==1.0.0
11 11
 django-detect==1.0.5
12
-django-file-md5==1.0.0
12
+django-file-md5==1.0.1
13 13
 django-ip==1.0.0
14 14
 django-json-response==1.1.4
15 15
 django-logit==1.0.6

+ 8 - 4
utils/storage_utils.py

@@ -29,12 +29,14 @@ def file_save(file_=None, file_path=None, prefix='img', ext='jpeg', watermark=Fa
29 29
     # Ext
30 30
     ext = os.path.splitext(file_.name)[-1] or ext
31 31
 
32
+    # Photo MD5
33
+    photo_md5 = calculate_md5(file_)
34
+
32 35
     # Photo UUID Get or Create
33
-    photo, created = PhotoUUIDInfo.objects.select_for_update().get_or_create(photo_md5=calculate_md5(file_))
36
+    photo, created = PhotoUUIDInfo.objects.select_for_update().get_or_create(photo_md5=photo_md5)
34 37
 
35 38
     # 照片路径
36
-    photo_path = photo.photo_path
37
-    if not photo_path:
39
+    if not photo.photo_path:
38 40
         photo_path = '{}/{}{}'.format(prefix, shortuuid.uuid(), ext)
39 41
         if default_storage.exists(photo_path):
40 42
             default_storage.delete(photo_path)
@@ -88,7 +90,9 @@ def file_save(file_=None, file_path=None, prefix='img', ext='jpeg', watermark=Fa
88 90
     return DotDict({
89 91
         'ext': ext,
90 92
 
91
-        'photo_path': photo_path,
93
+        'photo_md5': photo_md5,
94
+
95
+        'photo_path': photo.photo_path,
92 96
         'photo_w': photo.photo_w,
93 97
         'photo_h': photo.photo_h,
94 98
 

kodo - Gogs: Go Git Service

Nessuna descrizione

FFIB: 88b564d033 fix coercing to Unicode: need string or buffer, long found 5 anni fa
..
migrations 6a9e324f6f :art: Re Makemigrations 5 anni fa
__init__.py 627187a7d7 Update Kodo 8 anni fa
admin.py eb3484e6c2 后台管理去掉只读 5 anni fa
models.py 88b564d033 fix coercing to Unicode: need string or buffer, long found 5 anni fa
tests.py 627187a7d7 Update Kodo 8 anni fa
views.py 627187a7d7 Update Kodo 8 anni fa