Linkcheck

This package contains views for the broken link checker

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

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)

form: EditUrlForm | None = None[source]

The link edit form

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_context_data(**kwargs: Any) dict[str, Any][source]

Extend context by edit url form

Parameters:

**kwargs (Any) – The supplied keyword arguments

Returns:

The context dictionary

Return type:

dict[str, Any]

get_paginate_by(queryset: list[Url]) int[source]

Get the number of items to paginate by, or None for no pagination.

Parameters:

queryset (list[Url]) – The QuerySet of the filtered urls

Returns:

The pagination number

Return type:

int

get_pagination_params() str[source]

Get the urlencoded pagination GET parameters

Returns:

The URL params

Return type:

str

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]

instance: Url | None = None[source]

The currently edited instance

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

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

get_redirect_url(*args: Any, **kwargs: Any) str[source]

Retrieve url for redirection

Parameters:
  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

url to redirect to

Return type:

str

Linkcheck Stats View

class integreat_cms.cms.views.linkcheck.linkcheck_stats_view.LinkcheckStatsView(**kwargs)[source]

Bases: View

Return the linkcheck counter stats

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