Linkcheck
This package contains views for the broken link checker
Link Replace View
- class integreat_cms.cms.views.linkcheck.link_replace_view.LinkReplaceView(**kwargs)[source]
Bases:
TemplateView
View for link replace form
- __init__(**kwargs)[source]
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- get(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse [source]
Render link replace form
- Parameters:
request (HttpRequest) – Object representing the user call
*args (Any) – The supplied arguments
**kwargs (Any) – The supplied keyword arguments
- Returns:
The rendered template response
- Return type:
HttpResponse
- get_template_names()[source]
Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response() is overridden.
- post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse [source]
Applies link replace form
- Parameters:
request (HttpRequest) – The current request
*args (Any) – The supplied arguments
**kwargs (Any) – The supplied keyword arguments
- Raises:
Http404 – HTTP status 404 if the edited URL does not exist
- Returns:
Redirect to broken link list
- Return type:
HttpResponse
- render_to_response(context, **response_kwargs)[source]
Return a response, using the response_class for this view, with a template rendered with the given context.
Pass response_kwargs to the constructor of the response class.
- response_class[source]
alias of
TemplateResponse
Linkcheck List View
- class integreat_cms.cms.views.linkcheck.linkcheck_list_view.LinkcheckListView(**kwargs)[source]
Bases:
ListView
View for retrieving a list of urls grouped by their state
- __init__(**kwargs)[source]
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- context_object_name: str = 'filtered_urls'[source]
Designates the name of the variable to use in the context (see
MultipleObjectMixin
)
- dispatch(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse [source]
Dispatch the view to either get() or post()
- Parameters:
request (HttpRequest)
args (Any)
kwargs (Any)
- Return type:
HttpResponse
- extra_context: dict[str, str | int] = {'LINKCHECK_EMAIL_ENABLED': True, 'LINKCHECK_PHONE_ENABLED': True, 'current_menu_item': 'linkcheck'}[source]
The context dict passed to the template (see
ContextMixin
)
- get(request: HttpRequest, *args: Any, **kwargs: Any) TemplateResponse [source]
Return the get view and fall back to the last page if the requested page does not exist
- Parameters:
request (HttpRequest) – Object representing the user call
*args (Any) – The supplied arguments
**kwargs (Any) – The supplied keyword arguments
- Raises:
Http404 – When the view returns a 404 and already requests the last page
- Returns:
The rendered linkcheck template or a redirect to the last page
- Return type:
TemplateResponse
- get_allow_empty()[source]
Return
True
if the view should display empty lists andFalse
if a 404 should be raised instead.
- get_paginate_by(queryset: list[Url]) int [source]
Get the number of items to paginate by, or
None
for no pagination.
- get_paginate_orphans()[source]
Return the maximum number of orphans extend the last page by when paginating.
- get_pagination_params() str [source]
Get the urlencoded pagination GET parameters
- Returns:
The URL params
- Return type:
- get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True, **kwargs)[source]
Return an instance of the paginator for this view.
- get_queryset() list[Url] [source]
Selects all urls for the current region Finally annotates queryset by the content_type title
- Returns:
The QuerySet of the filtered urls
- Return type:
list[Url]
- get_template_names()[source]
Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response is overridden.
- post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse [source]
Applies selected action for selected urls
- Parameters:
request (HttpRequest) – The current request
*args (Any) – The supplied arguments
**kwargs (Any) – The supplied keyword arguments
- Raises:
Http404 – HTTP status 404 if the edited URL does not exist
- Returns:
Redirect to current linkcheck tab
- Return type:
HttpResponse
- render_to_response(context, **response_kwargs)[source]
Return a response, using the response_class for this view, with a template rendered with the given context.
Pass response_kwargs to the constructor of the response class.
- response_class[source]
alias of
TemplateResponse
- template_name: str = 'linkcheck/links_by_filter.html'[source]
The template to render (see
TemplateResponseMixin
)
Linkcheck Redirect View
- class integreat_cms.cms.views.linkcheck.linkcheck_redirect_view.LinkcheckRedirectView(**kwargs)[source]
Bases:
RedirectView
View for redirecting to main page of the broken link checker
- __init__(**kwargs)[source]
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
Linkcheck Stats View
- class integreat_cms.cms.views.linkcheck.linkcheck_stats_view.LinkcheckStatsView(**kwargs)[source]
Bases:
View
Return the linkcheck counter stats
- __init__(**kwargs)[source]
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- get(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse [source]
Retrieve the stats about valid/invalid/unchecked/ignored links
- Parameters:
request (HttpRequest) – The current request
*args (Any) – The supplied arguments
**kwargs (Any) – The supplied keyword arguments
- Returns:
The rendered template response
- Return type:
HttpResponse