pki.views.truststores ===================== .. py:module:: pki.views.truststores .. autoapi-nested-parse:: This module contains all views concerning the PKI -> Truststore section. Module Contents --------------- .. py:data:: DeviceModel :value: None .. py:class:: TruststoresRedirectView(**kwargs) Bases: :py:obj:`django.views.generic.base.RedirectView` View that redirects to the index of the PKI Truststores application: Truststores. .. py:attribute:: permanent :value: False .. py:attribute:: pattern_name :value: 'pki:truststores' .. py:class:: TruststoresContextMixin Bases: :py:obj:`trustpoint.page_context.PageContextMixin` Mixin which adds some extra context for the PKI Views. .. py:attribute:: page_category :value: 'pki' .. py:attribute:: page_name :value: 'truststores' .. py:class:: TruststoreTableView Bases: :py:obj:`TruststoresContextMixin`, :py:obj:`trustpoint.views.base.SortableTableMixin`\ [\ :py:obj:`pki.models.truststore.TruststoreModel`\ ], :py:obj:`django.views.generic.list.ListView`\ [\ :py:obj:`pki.models.truststore.TruststoreModel`\ ] Truststore Table View. .. py:attribute:: model .. py:attribute:: template_name :value: 'pki/truststores/truststores.html' .. py:attribute:: context_object_name :value: 'truststores' .. py:attribute:: paginate_by :value: 50 .. py:attribute:: default_sort_param :value: 'unique_name' .. py:attribute:: filterset_class .. py:method:: apply_filters(qs) Applies the `TruststoreFilter` to the given queryset. :param qs: The base queryset to filter. :returns: The filtered queryset according to GET parameters. .. py:method:: get_queryset() Filter queryset to only include truststores filtered by UI filters. :returns: Returns a queryset of all TruststoreModels, filtered by UI filters. .. py:method:: get_context_data(**kwargs) Adds the filter to the context. :param \*\*kwargs: Keyword arguments passed to super().get_context_data. :returns: The context to use for rendering the truststores page. .. py:class:: TruststoreCreateView Bases: :py:obj:`TruststoresContextMixin`, :py:obj:`django.views.generic.edit.FormView`\ [\ :py:obj:`pki.forms.TruststoreAddForm`\ ] View for creating a new Truststore. .. py:attribute:: model .. py:attribute:: form_class .. py:attribute:: template_name :value: 'pki/truststores/add/file_import.html' .. py:attribute:: ignore_url .. py:method:: dispatch(request, *args, **kwargs) Set context flags based on URL. .. py:method:: form_valid(form) If the form is valid, redirect to Truststore overview. .. py:method:: get_success_url() You could still use a success URL here if needed. .. py:method:: get_context_data(**kwargs) Include domain in context only if pk is present. .. py:data:: OID_MAP .. py:class:: TruststoreDetailView Bases: :py:obj:`TruststoresContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`pki.models.truststore.TruststoreModel`\ ] The truststore detail view. .. py:attribute:: model .. py:attribute:: success_url .. py:attribute:: ignore_url .. py:attribute:: template_name :value: 'pki/truststores/details.html' .. py:attribute:: context_object_name :value: 'truststore' .. py:method:: get_context_data(**kwargs) Adding map of attribute and its oid with its values. :param \*\*kwargs: Keyword arguments passed to super().get_context_data(). :returns: The context data. :rtype: dict .. py:class:: TruststoreDownloadView Bases: :py:obj:`TruststoresContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`pki.models.truststore.TruststoreModel`\ ] View for downloading a single truststore. .. py:attribute:: model .. py:attribute:: success_url .. py:attribute:: ignore_url .. py:attribute:: template_name :value: 'pki/truststores/download.html' .. py:attribute:: context_object_name :value: 'truststore' .. py:method:: get(request, pk = None, file_format = None, *args, **kwargs) 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. :param request: The HttpRequest object. :param pk: A string containing the certificate primary key. :param file_format: The format of the certificate to download. :param \*args: Positional arguments. :param \*\*kwargs: Keyword arguments. :returns: The HTTP response with either the download summary or a file download. :rtype: HttpResponse :raises Http404: .. py:class:: TruststoreMultipleDownloadView Bases: :py:obj:`TruststoresContextMixin`, :py:obj:`trustpoint.views.base.PrimaryKeyListFromPrimaryKeyString`, :py:obj:`django.views.generic.list.ListView`\ [\ :py:obj:`pki.models.truststore.TruststoreModel`\ ] View for downloading multiple truststores at once as archived files. .. py:attribute:: model .. py:attribute:: success_url .. py:attribute:: ignore_url .. py:attribute:: template_name :value: 'pki/truststores/download_multiple.html' .. py:attribute:: context_object_name :value: 'truststores' .. py:method:: get_context_data(*args, **kwargs) 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. :param \*args: Positional arguments, unused. :param \*\*kwargs: Keyword arguments passed to super().get_context_data(). :returns: The context data. :rtype: dict .. py:method:: get(request, pks = None, file_format = None, archive_format = None, *args, **kwargs) 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. :param request: The HttpRequest object. :param pks: A string containing the certificate primary keys, e.g. 1/2/3/4/5 :param file_format: The format of the archived certificate files. :param archive_format: The archive format that will be provided as download. :param \*args: Positional arguments. :param \*\*kwargs: Keyword arguments. :returns: The HTTP response with either the download summary or a file download. :rtype: HttpResponse :raises Http404: .. py:class:: TruststoreBulkDeleteConfirmView Bases: :py:obj:`TruststoresContextMixin`, :py:obj:`trustpoint.views.base.BulkDeleteView` View for confirming the deletion of multiple truststores. .. py:attribute:: model .. py:attribute:: success_url .. py:attribute:: ignore_url .. py:attribute:: template_name :value: 'pki/truststores/confirm_delete.html' .. py:attribute:: context_object_name :value: 'truststores' .. py:method:: get(request, *args, **kwargs) Handle GET requests. .. py:method:: form_valid(form) Attempts to delete the selected truststores on valid form. .. py:class:: TruststoreViewSet(**kwargs) Bases: :py:obj:`rest_framework.viewsets.ModelViewSet`\ [\ :py:obj:`pki.models.truststore.TruststoreModel`\ ] ViewSet for managing Truststore instances. Supports standard CRUD operations such as list, retrieve, create, update, and delete. .. py:attribute:: queryset .. py:attribute:: serializer_class .. py:attribute:: permission_classes .. py:attribute:: filter_backends .. py:attribute:: filterset_fields :type: ClassVar :value: ['intended_usage'] .. py:attribute:: search_fields :type: ClassVar :value: ['unique_name'] .. py:attribute:: ordering_fields :type: ClassVar :value: ['unique_name', 'created_at'] .. py:method:: create(request) API endpoint to create truststore. .. py:method:: list(_request) API endpoint to get all truststores.