API Documentation¶
-
class
wagtail_gallery.models.
Category
(*args, **kwargs)¶ Category to which a gallery page may belong
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
clean
()¶ Method that overrides models.Model clean method that ensures no circular references are made when it comes to the parent.
-
description
¶ Description of a category. Not currently used.
-
name
¶ Required. Name of the category.
-
parent
¶ Optional. Parent of the category. Not currently used but allows for sub-categories.
-
save
(*args, **kwargs)¶ Method that overrides models.Model save method so as to deal with the slug
-
slug
¶ Required. Not currently used. Slug of the category. I recommend making same as name.
-
exception
-
class
wagtail_gallery.models.
CategoryGalleryPage
(*args, **kwargs)¶ Used internally. Ignore
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
exception
-
class
wagtail_gallery.models.
GalleryImage
(*args, **kwargs)¶ A particular image that has an order component to it. Used to allow ordering of the gallery images on a specific gallery page
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
description
¶ Optional description of a particular image. Used as a caption for said image.
-
gallery
¶ Required. Not manually entered. A gallery to which to the object belongs
-
image
¶ Actual image to be used for said GalleryImage object
-
exception
-
class
wagtail_gallery.models.
GalleryPage
(id, path, depth, numchild, title, draft_title, slug, content_type, live, has_unpublished_changes, url_path, owner, seo_title, show_in_menus, search_description, go_live_at, expire_at, expired, locked, first_published_at, last_published_at, latest_revision_created_at, live_revision, page_ptr, body, description)¶ -
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
body
¶ Optional body of text that is shown on a specifc gallery page
-
categories
¶ Categories to which a particular gallery belongs
-
description
¶ Optional short description of the gallery used when showing cards etc.
-
get_archives
()¶ Gets the archives for the gallery
Return type: list
Returns: List of dictionaries of the form: [{‘date’: <GalleryPage Queryset>}]
-
get_categories
¶ Gets the categories available to all galleries
Return type: QuerySet
Returns: Queryset containing Category objects
-
get_context
(request, *args, **kwargs)¶ Gets the context for a specific gallery page
Parameters: - request (
HttpRequest
) – Django HttpRequest - args – Request args
- kwargs (
dict
) – Request kwargs
Returns: Context variable
- request (
-
get_gallery_base_url
¶ Gets the url of the root gallery page to which this gallery is attached
Return type: str
Returns: URL string
-
exception
-
class
wagtail_gallery.models.
GalleryParentPage
(*args, **kwargs)¶ Root page to which all galleries are attached
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶
-
archive
(request, **kwargs)¶ Routing for a particular category
Parameters: - request (
HttpRequest
) – Django HttpRequest - kwargs (
dict
) – Request kwargs
Return type: HttpResponse
Returns: HttpResponse
- request (
-
archiveCategoryMonth
(request, **kwargs)¶ Routing for a particular category filtered for a particular year and month
Parameters: - request (
HttpRequest
) – Django HttpRequest - kwargs (
dict
) – Request kwargs
Return type: HttpResponse
Returns: HttpResponse
- request (
-
archiveCategoryYear
(request, **kwargs)¶ Routing for a particular category filtered only by year
Parameters: - request (
HttpRequest
) – Django HttpRequest - kwargs (
dict
) – Request kwargs
Return type: HttpResponse
Returns: HttpResponse
- request (
-
archiveMonth
(request, **kwargs)¶ Route that returns archive page for a given year and month that contains said year and months gallery pages
Parameters: - request (
HttpRequest
) – Django HttpRequest - kwargs (
dict
) – Request kwargs
Return type: HttpResponse
Returns: HttpResponse page that shows said archives
- request (
-
archiveYear
(request, **kwargs)¶ Route that returns archive page for a given year that contains said year and months gallery pages
Parameters: - request (
HttpRequest
) – Django HttpRequest - kwargs (
dict
) – Request kwargs
Return type: HttpResponse
Returns: HttpResponse page that shows said archives
- request (
-
body
¶ Text that accompanies that appears on root gallery page
-
get_archives
()¶ Gets the archives of the gallery page objects
Return type: list
Returns: List of dictionaries containing [{‘date’: <GalleryPage object>]}
-
get_archives_category
(kwargs)¶ Gets the archives of the gallery page objects, but filtered for a specific category
Return type: list
Returns: List of dictionaries containing [{‘date’: <GalleryPage object>]}
-
get_categories
¶ Gets the categories available
Return type: QuerySet
Returns: Queryset consisting of gallery objects
-
get_context
(request, *args, **kwargs)¶ Overrides get_context of Page model and adds the archives and galleries to the context
Parameters: - request (
HttpRequest
) – Django HttpRequest - args – Request args
- kwargs (
dict
) – Request kwargs
Returns: Django context
- request (
-
get_galleries
¶ Gets the galleries that are the children of a specific parent page
Return type: QuerySet
Returns: Queryset containing Gallery objects
-
get_gallery_base_url
¶ URL of the base gallery parent page
Return type: str
Returns: URL string
-
get_pagination
(request, kwargs)¶ Get pagination for the galleries parent page
Parameters: - request (
HttpRequest
) – Django HttpRequest - kwargs – Request kwargs
Return type: Paginator
Returns: Pagination object
- request (
-
get_pagination_category
(request, kwargs)¶ Get pagination for the galleries parent page, but filtered by category
Parameters: - request (
HttpRequest
) – Django HttpRequest - kwargs – Request kwargs
Return type: Paginator
Returns: Pagination object
- request (
-
exception