Skip to content

meringue.protected.fields ¤

ProtectedFileMixin ¤

url property ¤

url

Link to the view with access verification to the file

redirect_url property ¤

redirect_url

Link to the file where nginx should serve it after access verification.

original_url property ¤

original_url

The original link to the file.

ProtectedFileField ¤

ProtectedFileField(
    view_name,
    verbose_name=None,
    name=None,
    upload_to="protected",
    storage=None,
    host_name=None,
    disposition="attachment",
    nginx_location_getter=m_settings.PROTECTED_NGINX_LOCATION_GETTER,
    **kwargs
)

Bases: FileField

A field that adds the mechanism of a protected file.

Source code in meringue/protected/fields.py
def __init__(
    self,
    view_name,
    verbose_name=None,
    name=None,
    upload_to="protected",
    storage=None,
    host_name=None,
    disposition="attachment",
    nginx_location_getter=m_settings.PROTECTED_NGINX_LOCATION_GETTER,
    **kwargs,
):
    self.m_protected_view_name = view_name
    self.m_protected_host_name = host_name
    self.m_protected_disposition = disposition
    self.m_protected_nginx_location_getter = nginx_location_getter
    super().__init__(verbose_name, name, upload_to, storage, **kwargs)

ProtectedImageField ¤

ProtectedImageField(
    view_name,
    verbose_name=None,
    name=None,
    width_field=None,
    height_field=None,
    host_name=None,
    disposition="attachment",
    nginx_location_getter=m_settings.PROTECTED_NGINX_LOCATION_GETTER,
    **kwargs
)

Bases: ImageField

A field that adds the mechanism of a protected image.

Source code in meringue/protected/fields.py
def __init__(
    self,
    view_name,
    verbose_name=None,
    name=None,
    width_field=None,
    height_field=None,
    host_name=None,
    disposition="attachment",
    nginx_location_getter=m_settings.PROTECTED_NGINX_LOCATION_GETTER,
    **kwargs,
):
    kwargs.setdefault("upload_to", "protected")
    self.m_protected_view_name = view_name
    self.m_protected_host_name = host_name
    self.m_protected_disposition = disposition
    self.m_protected_nginx_location_getter = nginx_location_getter
    super().__init__(verbose_name, name, width_field, height_field, **kwargs)