pki.views.truststoresΒΆ

This module contains all views concerning the PKI -> Truststore section.

ClassesΒΆ

TruststoresRedirectView

View that redirects to the index of the PKI Truststores application: Truststores.

TruststoresContextMixin

Mixin which adds some extra context for the PKI Views.

TruststoreTableView

Truststore Table View.

TruststoreCreateView

View for creating a new Truststore.

TruststoreDetailView

The truststore detail view.

TruststoreDownloadView

View for downloading a single truststore.

TruststoreMultipleDownloadView

View for downloading multiple truststores at once as archived files.

TruststoreBulkDeleteConfirmView

View for confirming the deletion of multiple truststores.

Module ContentsΒΆ

class pki.views.truststores.TruststoresRedirectView(**kwargs)[source]ΒΆ

Bases: django.views.generic.base.RedirectView

View that redirects to the index of the PKI Truststores application: Truststores.

permanent = False[source]ΒΆ
pattern_name = 'pki:truststores'[source]ΒΆ
class pki.views.truststores.TruststoresContextMixin[source]ΒΆ

Mixin which adds some extra context for the PKI Views.

extra_context: ClassVar[source]ΒΆ
class pki.views.truststores.TruststoreTableView[source]ΒΆ

Bases: TruststoresContextMixin, trustpoint.views.base.SortableTableMixin, django.views.generic.list.ListView[pki.models.truststore.TruststoreModel]

Truststore Table View.

model[source]ΒΆ
template_name = 'pki/truststores/truststores.html'[source]ΒΆ
context_object_name = 'truststores'[source]ΒΆ
paginate_by = 50[source]ΒΆ
default_sort_param = 'unique_name'[source]ΒΆ
class pki.views.truststores.TruststoreCreateView[source]ΒΆ

Bases: TruststoresContextMixin, django.views.generic.edit.FormView[pki.forms.TruststoreAddForm]

View for creating a new Truststore.

model[source]ΒΆ
form_class[source]ΒΆ
template_name = 'pki/truststores/add/file_import.html'[source]ΒΆ
ignore_url[source]ΒΆ
form_valid(form)[source]ΒΆ

If the form is valid, redirect to Truststore overview.

Parameters:

form (pki.forms.TruststoreAddForm)

Return type:

django.http.HttpResponseRedirect

get_success_url()[source]ΒΆ

You could still use a success URL here if needed.

Return type:

str

get_context_data(**kwargs)[source]ΒΆ

Include domain in context only if pk is present.

Parameters:

kwargs (dict[str, Any])

Return type:

dict[str, Any]

class pki.views.truststores.TruststoreDetailView[source]ΒΆ

Bases: TruststoresContextMixin, django.views.generic.detail.DetailView[pki.models.truststore.TruststoreModel]

The truststore detail view.

model[source]ΒΆ
success_url[source]ΒΆ
ignore_url[source]ΒΆ
template_name = 'pki/truststores/details.html'[source]ΒΆ
context_object_name = 'truststore'[source]ΒΆ
class pki.views.truststores.TruststoreDownloadView[source]ΒΆ

Bases: TruststoresContextMixin, django.views.generic.detail.DetailView[pki.models.truststore.TruststoreModel]

View for downloading a single truststore.

model[source]ΒΆ
success_url[source]ΒΆ
ignore_url[source]ΒΆ
template_name = 'pki/truststores/download.html'[source]ΒΆ
context_object_name = 'truststore'[source]ΒΆ
get(request, pk=None, file_format=None, *args, **kwargs)[source]ΒΆ

HTTP GET Method.

If only the certificate primary key are passed in the url, the download summary will be displayed. If value for file_format is also provided, a file download will be performed.

Compare the re_path regex in the pki.urls package.

Parameters:
  • request (django.http.HttpRequest) – The HttpRequest object.

  • pk (str | None) – A string containing the certificate primary key.

  • file_format (str | None) – The format of the certificate to download.

  • *args (tuple[Any]) – Positional arguments.

  • **kwargs (dict[str, Any]) – Keyword arguments.

Returns:

The HTTP response with either the download summary or a file download.

Return type:

HttpResponse

Raises:

Http404 –

class pki.views.truststores.TruststoreMultipleDownloadView[source]ΒΆ

Bases: TruststoresContextMixin, trustpoint.views.base.PrimaryKeyListFromPrimaryKeyString, django.views.generic.list.ListView[pki.models.truststore.TruststoreModel]

View for downloading multiple truststores at once as archived files.

model[source]ΒΆ
success_url[source]ΒΆ
ignore_url[source]ΒΆ
template_name = 'pki/truststores/download_multiple.html'[source]ΒΆ
context_object_name = 'truststores'[source]ΒΆ
get_context_data(**kwargs)[source]ΒΆ

Adding the part of the url to the context, that contains the truststores primary keys.

This is used for the {% url }% tags in the template to download files.

Parameters:

**kwargs (dict[str, Any]) – Keyword arguments passed to super().get_context_data().

Returns:

The context data.

Return type:

dict

get(request, pks=None, file_format=None, archive_format=None, *args, **kwargs)[source]ΒΆ

HTTP GET Method.

If only certificate primary keys are passed in the url, the download summary will be displayed. If value for file_format and archive_format are also provided, a file download will be performed.

Compare the re_path regex in the pki.urls package.

Parameters:
  • request (django.http.HttpRequest) – The HttpRequest object.

  • pks (str | None) – A string containing the certificate primary keys, e.g. 1/2/3/4/5

  • file_format (None | str) – The format of the archived certificate files.

  • archive_format (None | str) – The archive format that will be provided as download.

  • *args (tuple[Any]) – Positional arguments.

  • **kwargs (dict[str, Any]) – Keyword arguments.

Returns:

The HTTP response with either the download summary or a file download.

Return type:

HttpResponse

Raises:

Http404 –

class pki.views.truststores.TruststoreBulkDeleteConfirmView(**kwargs)[source]ΒΆ

Bases: TruststoresContextMixin, trustpoint.views.base.BulkDeleteView

View for confirming the deletion of multiple truststores.

model[source]ΒΆ
success_url[source]ΒΆ
ignore_url[source]ΒΆ
template_name = 'pki/truststores/confirm_delete.html'[source]ΒΆ
context_object_name = 'truststores'[source]ΒΆ
form_valid(form)[source]ΒΆ

Attempts to delete the selected truststores on valid form.

Parameters:

form (django.forms.Form)

Return type:

django.http.HttpResponse