File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33* .pyc
44* .pyo
55.idea /
6+ .venv /
67
78# Build-related files
89docs /_build /
Original file line number Diff line number Diff line change 99import logging
1010import os
1111import warnings
12+ import random
1213from typing import Dict , TypeVar
1314
1415from django .contrib .auth .hashers import make_password
@@ -258,11 +259,13 @@ class ImageField(FileField):
258259 def _make_data (self , params ):
259260 # ImageField (both django's and factory_boy's) require PIL.
260261 # Try to import it along one of its known installation paths.
261- from PIL import Image
262+ from PIL import Image , ImageColor
262263
263264 width = params .get ('width' , 100 )
264265 height = params .get ('height' , width )
265- color = params .get ('color' , 'blue' )
266+ color = params .get ('color' , random .choice ( # noqa: S311
267+ list (ImageColor .colormap .keys ()),
268+ ))
266269 image_format = params .get ('format' , 'JPEG' )
267270 image_palette = params .get ('palette' , 'RGB' )
268271
You can’t perform that action at this time.
0 commit comments