Django Widget API¶
Model Fields¶
-
class
pyuploadcare.dj.models.
FileField
(*args, **kwargs)¶ Django model field that stores uploaded file as Uploadcare CDN url.
-
class
pyuploadcare.dj.models.
ImageField
(manual_crop=None, *args, **kwargs)¶ Django model field that stores uploaded image as Uploadcare CDN url.
It supports manual crop as well. manual_crop can be set to one of the following values:
None
,"disabled"
— crop disabled;""
— crop is enabled and the user will be able to select any area on an image;"2:3"
— user will be able to select an area with aspect ratio 2:3;"200x300"
— same as previous, but if the selected area is bigger than 200x300, it will be scaled down to these dimensions;"200x300 upscale"
— same as previous, but the selected area will be scaled even if it is smaller than the specified size.
-
class
pyuploadcare.dj.models.
FileGroupField
(*args, **kwargs)¶ Django model field that stores uploaded file group as Uploadcare CDN url.
It provides multiple file uploading.
-
class
pyuploadcare.dj.models.
ImageGroupField
(*args, **kwargs)¶ Django model field that stores uploaded image group as Uploadcare CDN url.
It provides multiple image uploading.
Form Fields¶
-
class
pyuploadcare.dj.forms.
FileWidget
(attrs=None)¶ Django form widget that sets up Uploadcare Widget.
It adds js and hidden input with basic Widget’s params, e.g. data-public-key.
-
class
pyuploadcare.dj.forms.
FileField
(*args, **kwargs)¶ Django form field that uses
FileWidget
with default arguments.It always returns URL.
-
class
pyuploadcare.dj.forms.
ImageField
(manual_crop=None, *args, **kwargs)¶ Django form field that sets up
FileWidget
to work with images.
-
class
pyuploadcare.dj.forms.
FileGroupField
(*args, **kwargs)¶ Django form field that sets up
FileWidget
in multiupload mode.
-
class
pyuploadcare.dj.forms.
ImageGroupField
(*args, **kwargs)¶ Django form field that sets up
FileWidget
in image multiupload mode.