pki.views.truststoresΒΆ

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

AttributesΒΆ

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.

TruststoreViewSet

ViewSet for managing Truststore instances.

Module ContentsΒΆ

pki.views.truststores.DeviceModel = None[source]ΒΆ
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]ΒΆ

Bases: trustpoint.page_context.PageContextMixin

Mixin which adds some extra context for the PKI Views.

page_category = 'pki'[source]ΒΆ
page_name = 'truststores'[source]ΒΆ
class pki.views.truststores.TruststoreTableView[source]ΒΆ

Bases: TruststoresContextMixin, trustpoint.views.base.SortableTableMixin[pki.models.truststore.TruststoreModel], 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]ΒΆ
filterset_class[source]ΒΆ
apply_filters(qs)[source]ΒΆ

Applies the TruststoreFilter to the given queryset.

Parameters:

qs (django.db.models.QuerySet[pki.models.truststore.TruststoreModel]) – The base queryset to filter.

Returns:

The filtered queryset according to GET parameters.

Return type:

django.db.models.QuerySet[pki.models.truststore.TruststoreModel]

get_queryset()[source]ΒΆ

Filter queryset to only include truststores filtered by UI filters.

Returns:

Returns a queryset of all TruststoreModels, filtered by UI filters.

Return type:

django.db.models.QuerySet[pki.models.truststore.TruststoreModel]

get_context_data(**kwargs)[source]ΒΆ

Adds the filter to the context.

Parameters:

**kwargs (Any) – Keyword arguments passed to super().get_context_data.

Returns:

The context to use for rendering the truststores page.

Return type:

dict[str, Any]

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]ΒΆ
dispatch(request, *args, **kwargs)[source]ΒΆ

Set context flags based on URL.

Parameters:
  • request (django.http.HttpRequest)

  • args (Any)

  • kwargs (Any)

Return type:

django.http.HttpResponse

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]

pki.views.truststores.OID_MAP[source]ΒΆ
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]ΒΆ
get_context_data(**kwargs)[source]ΒΆ

Adding map of attribute and its oid with its values.

Parameters:

**kwargs (Any) – Keyword arguments passed to super().get_context_data().

Returns:

The context data.

Return type:

dict

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(*args, **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:
  • *args (Any) – Positional arguments, unused.

  • **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[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]ΒΆ
get(request, *args, **kwargs)[source]ΒΆ

Handle GET requests.

Parameters:
  • request (django.http.HttpRequest)

  • args (Any)

  • kwargs (Any)

Return type:

django.http.HttpResponse

form_valid(form)[source]ΒΆ

Attempts to delete the selected truststores on valid form.

Parameters:

form (django.forms.Form)

Return type:

django.http.HttpResponse

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

Bases: rest_framework.viewsets.ModelViewSet[pki.models.truststore.TruststoreModel]

ViewSet for managing Truststore instances.

Supports standard CRUD operations such as list, retrieve, create, update, and delete.

queryset[source]ΒΆ
serializer_class[source]ΒΆ
permission_classes[source]ΒΆ
filter_backends[source]ΒΆ
filterset_fields: ClassVar = ['intended_usage'][source]ΒΆ
search_fields: ClassVar = ['unique_name'][source]ΒΆ
ordering_fields: ClassVar = ['unique_name', 'created_at'][source]ΒΆ
create(request, *args, **_kwargs)[source]ΒΆ

API endpoint to create truststore.

Parameters:
  • request (django.http.HttpRequest)

  • args (Any)

  • _kwargs (Any)

Return type:

django.http.HttpResponse

list(request, *args, **_kwargs)[source]ΒΆ

API endpoint to get all truststores.

Parameters:
  • request (django.http.HttpRequest)

  • args (Any)

  • _kwargs (Any)

Return type:

django.http.HttpResponse