Image handling views
Base image handling Views
If not disabled, each image model need to have 3 views for uploading, fetching and cropping. User should subclass the following Class-based image handling base views for your custom image models.
- class galleryfield.image_views.ImageCreateView(**kwargs)[source]
The Class-based view handling the saving of uploaded image.
- target_model
When not set, defaults to
garllery_widget.BuiltInGalleryImage
- crop_url_name
When
disable_server_side_crop
is False, ifNone
or an invalid URL name will raise anImproperlyConfigured
error.
- disable_server_side_crop
Defaults to
False
- create_instance_from_form(form)[source]
User should provide this method to save the object which will be used in form_valid method. Typically,
self.object
is expected to be saved here with the-save-method.See
galleryfield.image_views.BuiltInImageCreateView
for example.
- class galleryfield.image_views.ImageListView(**kwargs)[source]
The Class-based view for fetching the existing images of the gallery instance.
- target_model
When not set, defaults to
garllery_widget.BuiltInGalleryImage
- crop_url_name
When
disable_server_side_crop
is False, ifNone
or an invalid URL name will raise anImproperlyConfigured
error.
- disable_server_side_crop
Defaults to
False
- class galleryfield.image_views.ImageCropView(**kwargs)[source]
The Class-based view handling server side cropping of an image model instance. Note that a new image model instance will be created rather than updating the cropped instance.
- target_model
When not set, defaults to
garllery_widget.BuiltInGalleryImage
- crop_url_name
When
disable_server_side_crop
is False, ifNone
or an invalid URL name will raise anImproperlyConfigured
error.
- disable_server_side_crop
Defaults to
False
- create_cropped_instance_from_form(form)[source]
User should provide this method to save the object which will be used in form_valid method. Typically, self.object is expected to be saved here with the-save-method.
See
galleryfield.image_views.BuiltInImageCropView
for example.Note that beside the id (pk) and image field, all other field values of the saved cropped instance will be the same with the original instance. You need to set those values before calling
self.object.save()
method.