OwlCyberSecurity - MANAGER
Edit File: detail.cpython-39.pyc
a ���e � @ s� d dl mZ d dlmZ d dlmZ d dlmZ d dl m Z mZmZ G dd� de �Z G dd � d e e�ZG d d� de�ZG dd � d ee�ZdS )� )�ImproperlyConfigured)�models)�Http404)�gettext)�ContextMixin�TemplateResponseMixin�Viewc s^ e Zd ZdZdZdZdZdZdZdZ dZ ddd�Zdd � Zd d� Z dd � Z� fdd�Z� ZS )�SingleObjectMixinzS Provide the ability to retrieve a single object for further manipulation. N�slug�pkFc C s� |du r| � � }| j�| j�}| j�| j�}|dur@|j|d�}|durr|du sV| jrr| �� }|jf i ||i��}|du r�|du r�td| j j ��z|�� }W n0 |jjy� t td�d|jjji ��Y n0 |S )z� Return the object the view is displaying. Require `self.queryset` and a `pk` or `slug` argument in the URLconf. Subclasses can override this to return any object. N)r zXGeneric detail view %s must be called with either an object pk or a slug in the URLconf.z,No %(verbose_name)s found matching the query�verbose_name)�get_queryset�kwargs�get�pk_url_kwarg�slug_url_kwarg�filter�query_pk_and_slug�get_slug_field�AttributeError� __class__�__name__�modelZDoesNotExistr �_�_metar )�self�querysetr r � slug_field�obj� r �\/home/gouroczh/virtualenv/pat/3.9/lib/python3.9/site-packages/django/views/generic/detail.py� get_object s0 ���� zSingleObjectMixin.get_objectc C s: | j du r0| jr| jj�� S tdd| jji ��| j �� S )z� Return the `QuerySet` that will be used to look up the object. This method is called by the default implementation of get_object() and may not be called if get_object() is overridden. Nzj%(cls)s is missing a QuerySet. Define %(cls)s.model, %(cls)s.queryset, or override %(cls)s.get_queryset().�cls)r r Z_default_manager�allr r r �r r r r r = s ��zSingleObjectMixin.get_querysetc C s | j S )z;Get the name of a slug field to be used to look up by slug.)r r$ r r r r O s z SingleObjectMixin.get_slug_fieldc C s( | j r| j S t|tj�r |jjS dS dS )z#Get the name to use for the object.N)�context_object_name� isinstancer �Modelr � model_name)r r r r r �get_context_object_nameS s z)SingleObjectMixin.get_context_object_namec sJ i }| j r.| j |d<