
    h                         S SK Jr  S SKJr  S SKJr  S SKJr  S SK	J
r
JrJr   " S S\
5      r " S S	\\5      r " S
 S\5      r " S S\\5      rg)    )ImproperlyConfigured)models)Http404)gettext)ContextMixinTemplateResponseMixinViewc                   d   ^  \ rS rSrSrSrSrSrSrSr	Sr
SrSS jrS rS	 rS
 rU 4S jrSrU =r$ )SingleObjectMixin   zK
Provide the ability to retrieve a single object for further manipulation.
NslugpkFc                 t   Uc  U R                  5       nU R                  R                  U R                  5      nU R                  R                  U R                  5      nUb  UR                  US9nUb7  Ub  U R                  (       a#  U R                  5       nUR
                  " S0 XC0D6nUc%  Uc"  [        SU R                  R                  -  5      e UR                  5       nU$ ! UR                  R                   a8    [        [        S5      SUR                  R                  R                   0-  5      ef = f)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.
)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__modelDoesNotExistr   __metar   )selfquerysetr   r   
slug_fieldobjs         M/var/www/html/env/lib/python3.13/site-packages/django/views/generic/detail.py
get_objectSingleObjectMixin.get_object   s+    ((*H [[__T../{{t223>"-H t/E/E,,.J<*);<H :$, /151H1HI 
	,,.C 
 ~~** 	@A!8>>#7#7#D#DEF 	s   C% %AD7c                    U R                   cY  U R                  (       a$  U R                  R                  R                  5       $ [	        SSU R
                  R                  0-  5      eU R                   R                  5       $ )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.
zj%(cls)s is missing a QuerySet. Define %(cls)s.model, %(cls)s.queryset, or override %(cls)s.get_queryset().cls)r"   r   _default_managerallr   r   r   r!   s    r%   r   SingleObjectMixin.get_queryset=   sm     == zzzz226688*.168O8O0PQ 
 }}  ""    c                     U R                   $ )z;Get the name of a slug field to be used to look up by slug.)r#   r,   s    r%   r    SingleObjectMixin.get_slug_fieldO   s    r.   c                     U R                   (       a  U R                   $ [        U[        R                  5      (       a  UR                  R
                  $ g)z#Get the name to use for the object.N)context_object_name
isinstancer   Modelr    
model_name)r!   r$   s     r%   get_context_object_name)SingleObjectMixin.get_context_object_nameS   s;    ##+++V\\**99'''r.   c                    > 0 nU R                   (       a?  U R                   US'   U R                  U R                   5      nU(       a  U R                   X#'   UR                  U5        [        TU ]  " S0 UD6$ )z/Insert the single object into the context dict.objectr   )r9   r6   updatesuperget_context_data)r!   r   contextr2   r   s       r%   r<   "SingleObjectMixin.get_context_data\   s`    ;; $GH"&">">t{{"K"/3{{,vw'2'22r.   r   )N)r   
__module____qualname____firstlineno____doc__r   r"   r#   r2   r   r   r   r&   r   r   r6   r<   __static_attributes____classcell__r   s   @r%   r   r      sN     EHJNL&P#$	3 	3r.   r   c                       \ rS rSrSrS rSrg)BaseDetailViewh   z+A base view for displaying a single object.c                     U R                  5       U l        U R                  U R                  S9nU R                  U5      $ )Nr9   )r&   r9   r<   render_to_response)r!   requestargsr   r=   s        r%   r   BaseDetailView.getk   s8    oo'''t{{';&&w//r.   rJ   N)r   r?   r@   rA   rB   r   rC   r   r.   r%   rG   rG   h   s
    50r.   rG   c                   0   ^  \ rS rSrSrSrU 4S jrSrU =r$ )!SingleObjectTemplateResponseMixinq   N_detailc                 <  >  [         TU ]  5       nU$ ! [         Ga}    / nU R                  (       aK  U R                  (       a:  [        U R                  U R                  S5      nU(       a  UR                  SU5        [        U R                  [        R                  5      (       aQ  U R                  R                  nUR                  UR                  < SUR                  < U R                  < S35        O[        U SS5      b  [        U R                   [        R                  5      (       ab  UR                  U R                   R                  R                  < SU R                   R                  R                  < U R                  < S35        U(       d  e  U$ f = f)a  
Return a list of template names to be used for the request. May not be
called if render_to_response() is overridden. Return the following list:

* the value of ``template_name`` on the view (if provided)
* the contents of the ``template_name_field`` field on the
  object instance that the view is operating upon (if available)
* ``<app_label>/<model_name><template_name_suffix>.html``
Nr   /z.htmlr   )r;   get_template_namesr   r9   template_name_fieldgetattrinsertr3   r   r4   r    append	app_labelr5   template_name_suffix
issubclassr   )r!   namesnameobject_metar   s       r%   rU   4SingleObjectTemplateResponseMixin.get_template_namesu   sG   *	G.0EV U $ (	 E
 {{t77t{{D,D,DdKLLD) $++v||44"kk// $--#..11	 w-9j

FLL? ?  

((22

((3311	   U(	s    FFFr   )	r   r?   r@   rA   rV   r[   rU   rC   rD   rE   s   @r%   rP   rP   q   s    $6 6r.   rP   c                       \ rS rSrSrSrg)
DetailView   z
Render a "detail" view of an object.

By default this is a model instance looked up from `self.queryset`, but the
view will support display of *any* object by overriding `self.get_object()`.
r   N)r   r?   r@   rA   rB   rC   r   r.   r%   rb   rb      s    r.   rb   N)django.core.exceptionsr   	django.dbr   django.httpr   django.utils.translationr   r   django.views.generic.baser   r   r	   r   rG   rP   rb   r   r.   r%   <module>ri      sR    7   1 O O]3 ]3@0& 0:(= :z2N r.   