File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 13
13
from rest_framework import serializers
14
14
15
15
from common .exception .app_exception import NotFound404
16
- from common .field .common import UploadedFileField
16
+ from common .field .common import UploadedImageField
17
17
from common .util .field_message import ErrMessage
18
18
from dataset .models import Image
19
19
20
20
21
21
class ImageSerializer (serializers .Serializer ):
22
- image = UploadedFileField (required = True , error_messages = ErrMessage .file ("图片" ))
22
+ image = UploadedImageField (required = True , error_messages = ErrMessage .image ("图片" ))
23
23
24
24
def upload (self , with_valid = True ):
25
25
if with_valid :
Original file line number Diff line number Diff line change 3
3
import os
4
4
from pathlib import Path
5
5
6
+ from PIL import Image
7
+
6
8
from ..const import CONFIG , PROJECT_DIR
7
9
8
10
mimetypes .add_type ("text/css" , ".css" , True )
9
11
mimetypes .add_type ("text/javascript" , ".js" , True )
10
12
# Build paths inside the project like this: BASE_DIR / 'subdir'.
11
13
BASE_DIR = Path (__file__ ).resolve ().parent .parent
12
-
14
+ Image . MAX_IMAGE_PIXELS = 20000000000
13
15
# Quick-start development settings - unsuitable for production
14
16
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
15
17
You can’t perform that action at this time.
0 commit comments