pki.views.crlsΒΆ

CRL views for the PKI application.

ClassesΒΆ

CrlContextMixin

Mixin which adds context_data for the PKI -> CRLs pages.

CrlTableView

Table view for all CRLs.

CrlBulkDeleteConfirmView

View to confirm the deletion of multiple CRLs.

CrlDownloadView

View for downloading a single CRL.

CrlDetailView

Detail view for a single CRL.

CrlImportForm

Form for importing CRLs.

CrlImportView

View for importing CRLs.

Module ContentsΒΆ

class pki.views.crls.CrlContextMixin[source]ΒΆ

Bases: trustpoint.views.base.ContextDataMixin

Mixin which adds context_data for the PKI -> CRLs pages.

context_page_category = 'pki'[source]ΒΆ
context_page_name = 'crls'[source]ΒΆ
class pki.views.crls.CrlTableView[source]ΒΆ

Bases: CrlContextMixin, django.views.generic.ListView[pki.models.CrlModel]

Table view for all CRLs.

model[source]ΒΆ
template_name = 'pki/crls/crls.html'[source]ΒΆ
context_object_name = 'crls'[source]ΒΆ
paginate_by = None[source]ΒΆ
get_queryset()[source]ΒΆ

Return all CRL models with related CA information.

Return type:

django.db.models.QuerySet[pki.models.CrlModel]

class pki.views.crls.CrlBulkDeleteConfirmView[source]ΒΆ

Bases: trustpoint.views.base.BulkDeleteView

View to confirm the deletion of multiple CRLs.

model[source]ΒΆ
success_url[source]ΒΆ
ignore_url[source]ΒΆ
template_name = 'pki/crls/confirm_delete.html'[source]ΒΆ
context_object_name = 'crls'[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]ΒΆ

Delete the selected CRLs on valid form.

Parameters:

form (django.forms.Form)

Return type:

django.http.HttpResponse

class pki.views.crls.CrlDownloadView[source]ΒΆ

Bases: CrlContextMixin, django.views.generic.detail.DetailView[pki.models.CrlModel]

View for downloading a single CRL.

model[source]ΒΆ
success_url[source]ΒΆ
ignore_url[source]ΒΆ
template_name = 'pki/crls/download.html'[source]ΒΆ
context_object_name = 'crl'[source]ΒΆ
get_queryset()[source]ΒΆ

Return all CRL models with related CA information.

Return type:

django.db.models.QuerySet[pki.models.CrlModel]

get_object(queryset=None)[source]ΒΆ

Get the CRL object, handling both CRL primary keys and CA primary keys.

Parameters:

queryset (django.db.models.QuerySet[pki.models.CrlModel] | None)

Return type:

pki.models.CrlModel

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

HTTP GET Method.

If only the CRL 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.

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

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

  • file_format (str | None) – The format of the CRL 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.crls.CrlDetailView[source]ΒΆ

Bases: CrlContextMixin, django.views.generic.detail.DetailView[pki.models.CrlModel]

Detail view for a single CRL.

model[source]ΒΆ
success_url[source]ΒΆ
ignore_url[source]ΒΆ
template_name = 'pki/crls/details.html'[source]ΒΆ
context_object_name = 'crl'[source]ΒΆ
get_queryset()[source]ΒΆ

Return CRL models with related CA information.

Return type:

django.db.models.QuerySet[pki.models.CrlModel]

get_object(queryset=None)[source]ΒΆ

Get the CRL object, handling both CRL primary keys and CA primary keys.

Parameters:

queryset (django.db.models.QuerySet[pki.models.CrlModel] | None)

Return type:

pki.models.CrlModel

get_context_data(**kwargs)[source]ΒΆ

Add additional context data for the CRL detail view.

Parameters:

kwargs (Any)

Return type:

dict[str, Any]

class pki.views.crls.CrlImportForm(*args, **kwargs)[source]ΒΆ

Bases: django.forms.Form

Form for importing CRLs.

Parameters:
  • args (Any)

  • kwargs (Any)

crl_file[source]ΒΆ
ca: django.forms.ModelChoiceField[pki.models.CaModel][source]ΒΆ
set_active[source]ΒΆ
class pki.views.crls.CrlImportView[source]ΒΆ

Bases: CrlContextMixin, django.views.generic.edit.FormView[CrlImportForm]

View for importing CRLs.

form_class[source]ΒΆ
template_name = 'pki/crls/import.html'[source]ΒΆ
success_url[source]ΒΆ
form_valid(form)[source]ΒΆ

Handle valid form submission.

Parameters:

form (CrlImportForm)

Return type:

django.http.HttpResponse

_convert_to_pem(file_content)[source]ΒΆ

Convert file content to PEM format by automatically detecting the format.

Parameters:

file_content (bytes) – The raw file content as bytes

Returns:

The CRL in PEM format

Return type:

str

Raises:

ValidationError – If the conversion fails for all supported formats

_try_pem(file_content)[source]ΒΆ

Try to load as PEM format.

Parameters:

file_content (bytes)

Return type:

str

_try_der(file_content)[source]ΒΆ

Try to load as DER format.

Parameters:

file_content (bytes)

Return type:

str

_try_pkcs7_pem(file_content)[source]ΒΆ

Try to load as PKCS#7 PEM format.

Parameters:

file_content (bytes)

Return type:

str

_try_pkcs7_der(file_content)[source]ΒΆ

Try to load as PKCS#7 DER format.

Parameters:

file_content (bytes)

Return type:

str