Les galleries (gallery/
)
Module situé dans zds/gallery/
.
Modèles (models.py
)
- class zds.gallery.models.Gallery(id, title, subtitle, slug, pubdate, update)
- exception DoesNotExist
- exception MultipleObjectsReturned
- get_absolute_url()
URL of a single Gallery.
- Renvoie:
Gallery object URL
- Type renvoyé:
str
- get_gallery_path()
Get the filesystem path to this gallery root.
- Renvoie:
filesystem path to this gallery root
- Type renvoyé:
unicode
- get_images()
Get all images in the gallery, ordered by publication date.
- Renvoie:
all images in the gallery
- Type renvoyé:
QuerySet
- get_last_image()
Get the last image added in the gallery.
- Renvoie:
last image added in the gallery
- Type renvoyé:
Image object
- get_linked_users()
Get all the linked users for this gallery whatever their rights
- Renvoie:
all the linked users for this gallery
- Type renvoyé:
QuerySet
- get_users_and_permissions()
Get all the linked users for this gallery, and their rights
- Renvoie:
all the linked users for this gallery, with their permissions
- Type renvoyé:
dict
- save(*args, **kwargs)
Save the current instance. Override this in a subclass if you want to control the saving process.
The “force_insert” and “force_update” parameters can be used to insist that the « save » must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- class zds.gallery.models.Image(*args, **kwargs)
Represent an image in database
- exception DoesNotExist
- exception MultipleObjectsReturned
- get_absolute_url()
URL of a single Image.
- Renvoie:
Image object URL
- Type renvoyé:
str
- get_extension()
Get the extension of an image (used in tests).
- Renvoie:
the extension of the image
- Type renvoyé:
unicode
- save(*args, **kwargs)
Save the current instance. Override this in a subclass if you want to control the saving process.
The “force_insert” and “force_update” parameters can be used to insist that the « save » must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- class zds.gallery.models.UserGallery(*args, **kwargs)
A gallery of images created by a user.
- exception DoesNotExist
- exception MultipleObjectsReturned
- can_read()
Check if user can read in the gallery.
- Renvoie:
True if user can read in the gallery
- Type renvoyé:
bool
- can_write()
Check if user can write in the gallery.
- Renvoie:
True if user can write in the gallery
- Type renvoyé:
bool
- get_images()
Get all images in the gallery.
- Renvoie:
all images in the gallery
- Type renvoyé:
QuerySet
- zds.gallery.models.auto_delete_file_on_delete(sender, instance, **kwargs)
Deletes image from filesystem when corresponding object is deleted.
- Renvoie:
nothing
- Type renvoyé:
None
- zds.gallery.models.auto_delete_image_on_delete(sender, instance, **kwargs)
Deletes image from filesystem when corresponding object is deleted.
- Renvoie:
nothing
- Type renvoyé:
None
- zds.gallery.models.image_path(instance, filename)
Get the local filesystem path of the uploaded image. This function is used in models.
- Paramètres:
instance (str) – an instance of the model where the ImageField is defined
filename (str) – the filename that was originally given to the file
- Renvoie:
local filesystem path of the uploaded image
- Type renvoyé:
unicode
Vues (views.py
)
- class zds.gallery.views.DeleteGalleries(**kwargs)
- class zds.gallery.views.EditGallery(**kwargs)
Update gallery information
- form_class
alias de
UpdateGalleryForm
- form_valid(form)
If the form is valid, redirect to the supplied URL.
- get_context_data(**kwargs)
Insert the form into the context dict.
- get_form_kwargs()
Return the keyword arguments for instantiating the form.
- class zds.gallery.views.EditGalleryMembers(**kwargs)
Update gallery members
- form_class
alias de
UserGalleryForm
- form_invalid(form)
If the form is invalid, render the invalid form.
- form_valid(form)
If the form is valid, redirect to the supplied URL.
- get_form_kwargs()
Return the keyword arguments for instantiating the form.
- class zds.gallery.views.EditImage(**kwargs)
Edit or view an existing image.
- form_class
alias de
UpdateImageForm
- form_valid(form)
If the form is valid, redirect to the supplied URL.
- get(request, *args, **kwargs)
Handle GET requests: instantiate a blank version of the form.
- get_context_data(**kwargs)
Insert the form into the context dict.
- get_form_kwargs()
Return the keyword arguments for instantiating the form.
- post(request, *args, **kwargs)
Handle POST requests: instantiate a form instance with the passed POST variables and then check if it’s valid.
- class zds.gallery.views.GalleryDetails(**kwargs)
Gallery details
- get_context_data(**kwargs)
Get the context for this view. This method is surcharged to modify the paginator and information given at the template.
- get_queryset()
Return the list of items for this view.
The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.
- class zds.gallery.views.ImageFromGalleryContextViewMixin(**kwargs)
- class zds.gallery.views.ImageFromGalleryViewMixin(**kwargs)
Mixin that ensure the access to the gallery and fill context data properly
- class zds.gallery.views.ImportImages(**kwargs)
Create images from zip archive.
- form_class
alias de
ArchiveImageForm
- form_valid(form)
If the form is valid, redirect to the supplied URL.
- class zds.gallery.views.ListGallery(**kwargs)
Display the gallery list with all their images
- get_context_data(**kwargs)
Get the context for this view. This method is surcharged to modify the paginator and information given at the template.
- get_queryset()
Return the list of items for this view.
The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.
- object
alias de
UserGallery
Le context processor pour trouver la galerie automatique (auto_upload_gallery.py
)
- zds.gallery.auto_upload_gallery.get_auto_upload_gallery(request: HttpRequest)
This context processor adds
auto_update_gallery
to context. The gallery is the « default gallery » on forums and comments. On publishable content edition, it’s the content-specific gallery. :param request: the http request to use :return: a dictionary withauto_update_gallery
key