Ë
    ñ%9jj  ã                   ó„   — d Z ddlmZmZmZmZ ddlmZ ddlm	Z	m
Z
 ddlmZ 	 dd„Zddd	œd
„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zy)zµ
This module collects helper functions and classes that "span" multiple levels
of MVC. In other words, these functions/classes introduce controlled coupling
for convenience's sake.
é    )ÚHttp404ÚHttpResponseÚHttpResponsePermanentRedirectÚHttpResponseRedirect)Úloader)ÚNoReverseMatchÚreverse)ÚPromiseNc                 óN   — t        j                  ||| |¬«      }t        |||«      S )zœ
    Return an HttpResponse whose content is filled with the result of calling
    django.template.loader.render_to_string() with the passed arguments.
    )Úusing)r   Úrender_to_stringr   )ÚrequestÚtemplate_nameÚcontextÚcontent_typeÚstatusr   Úcontents          úL/var/www/html/truck-me/venv/lib/python3.12/site-packages/django/shortcuts.pyÚrenderr      s)   € ô ×%Ñ% m°W¸gÈUÔS€GÜ˜ ¨vÓ6Ð6ó    F)Ú	permanentÚpreserve_requestc                óL   — |rt         nt        } |t        | g|¢­i |¤Ž|¬«      S )ak  
    Return an HttpResponseRedirect to the appropriate URL for the arguments
    passed.

    The arguments could be:

        * A model: the model's `get_absolute_url()` function will be called.

        * A view name, possibly with arguments: `urls.reverse()` will be used
          to reverse-resolve the name.

        * A URL, which will be used as-is for the redirect location.

    Issues a temporary redirect by default. Set permanent=True to issue a
    permanent redirect. Set preserve_request=True to instruct the user agent
    to preserve the original HTTP method and body when following the redirect.
    )r   )r   r   Úresolve_url)Útor   r   ÚargsÚkwargsÚredirect_classs         r   Úredirectr      s6   € ñ& *3Õ%Ô8Lð ñ Ü�BÐ(˜Ò( Ñ(Ø)ôð r   c                 óR   — t        | d«      r| j                  j                  «       S | S )zÃ
    Return a QuerySet or a Manager.
    Duck typing in action: any class with a `get()` method (for
    get_object_or_404) or a `filter()` method (for get_list_or_404) might do
    the job.
    Ú_default_manager)Úhasattrr!   Úall)Úklasss    r   Ú_get_querysetr%   8   s)   € ô ˆuÐ(Ô)Ø×%Ñ%×)Ñ)Ó+Ð+Ø€Lr   c                 óh  — t        | «      }t        |d«      s@t        | t        «      r| j                  n| j
                  j                  }t        d|z  «      ‚	  |j                  |i |¤ŽS # |j                  j                  $ r- t        d|j                  j                  j                  z  «      ‚w xY w)aY  
    Use get() to return an object, or raise an Http404 exception if the object
    does not exist.

    klass may be a Model, Manager, or QuerySet object. All other passed
    arguments and keyword arguments are used in the get() query.

    Like with QuerySet.get(), MultipleObjectsReturned is raised if more than
    one object is found.
    ÚgetzVFirst argument to get_object_or_404() must be a Model, Manager, or QuerySet, not '%s'.úNo %s matches the given query.)r%   r"   Ú
isinstanceÚtypeÚ__name__Ú	__class__Ú
ValueErrorr'   ÚmodelÚDoesNotExistr   Ú_metaÚobject_name©r$   r   r   ÚquerysetÚklass__names        r   Úget_object_or_404r5   E   s®   € ô ˜UÓ#€HÜ�8˜UÔ#ä(¨´Ô5ˆE�NŠN¸5¿?¹?×;SÑ;Sð 	ô ð%Ø'2ñ3ó
ð 	
ð
Øˆx�|‰|˜TÐ, VÑ,Ð,øØ�>‰>×&Ñ&ò 
ÜØ,¨x¯~©~×/CÑ/C×/OÑ/OÑOó
ð 	
ð
ús   ÁA+ Á+AB1c              �   óˆ  K  — t        | «      }t        |d«      sAt        | t        «      r| j                  n| j
                  j                  }t        d|› d�«      ‚	  |j                  |i |¤Žƒ d{  –—† S 7 Œ# |j                  j                  $ r. t        d|j                  j                  j                  › d�«      ‚w xY w­w)zSee get_object_or_404().ÚagetzSFirst argument to aget_object_or_404() must be a Model, Manager, or QuerySet, not 'ú'.NúNo ú matches the given query.)r%   r"   r)   r*   r+   r,   r-   r7   r.   r/   r   r0   r1   r2   s        r   Úaget_object_or_404r;   a   s½   è ø€ ä˜UÓ#€HÜ�8˜VÔ$ä(¨´Ô5ˆE�NŠN¸5¿?¹?×;SÑ;Sð 	ô ðØ)˜]¨"ð.ó
ð 	
ðYØ"�X—]‘] DÐ3¨FÑ3×3Ð3Ð3ùØ�>‰>×&Ñ&ò YÜ˜˜HŸN™N×0Ñ0×<Ñ<Ð=Ð=VÐWÓXÐXðYüs1   ‚ACÁA8 Á1A6Á2A8 Á5CÁ6A8 Á8AB?Â?Cc                 óF  — t        | «      }t        |d«      s@t        | t        «      r| j                  n| j
                  j                  }t        d|z  «      ‚t         |j                  |i |¤Ž«      }|s,t        d|j                  j                  j                  z  «      ‚|S )zø
    Use filter() to return a list of objects, or raise an Http404 exception if
    the list is empty.

    klass may be a Model, Manager, or QuerySet object. All other passed
    arguments and keyword arguments are used in the filter() query.
    ÚfilterzTFirst argument to get_list_or_404() must be a Model, Manager, or QuerySet, not '%s'.r(   )r%   r"   r)   r*   r+   r,   r-   Úlistr=   r   r.   r0   r1   )r$   r   r   r3   r4   Úobj_lists         r   Úget_list_or_404r@   r   s    € ô ˜UÓ#€HÜ�8˜XÔ&ä(¨´Ô5ˆE�NŠN¸5¿?¹?×;SÑ;Sð 	ô ð"Ø$/ñ0ó
ð 	
ô �O�H—O‘O TÐ4¨VÑ4Ó5€HÙÜØ,¨x¯~©~×/CÑ/C×/OÑ/OÑOó
ð 	
ð €Or   c              �   óv  K  — t        | «      }t        |d«      sAt        | t        «      r| j                  n| j
                  j                  }t        d|› d�«      ‚ |j                  |i |¤Ž2 �cg c3 d{  –—† }|‘Œ7 Œ6 nc c}w }}|s-t        d|j                  j                  j                  › d�«      ‚|S ­w)zSee get_list_or_404().r=   zQFirst argument to aget_list_or_404() must be a Model, Manager, or QuerySet, not 'r8   Nr9   r:   )r%   r"   r)   r*   r+   r,   r-   r=   r   r.   r0   r1   )r$   r   r   r3   r4   Úobjr?   s          r   Úaget_list_or_404rC   ‹   s¸   è ø€ ä˜UÓ#€HÜ�8˜XÔ&ä(¨´Ô5ˆE�NŠN¸5¿?¹?×;SÑ;Sð 	ô ðØ)˜]¨"ð.ó
ð 	
ð &5 X§_¡_°dÐ%E¸fÑ%E×FÔF˜c’ÐFøÑFùÒF€HÐFÙÜ˜˜HŸN™N×0Ñ0×<Ñ<Ð=Ð=VÐWÓXÐXØ€Oùs6   ‚A-B9Á/BÁ1A?Á5A=
Á6A?Á9BÁ=A?Á?BÂ 9B9c                 ó  — t        | d«      r| j                  «       S t        | t        «      rt	        | «      } t        | t        «      r| j                  d«      r| S 	 t        | ||¬«      S # t        $ r t        | «      r‚ d| vrd| vr‚ Y | S w xY w)aM  
    Return a URL appropriate for the arguments passed.

    The arguments could be:

        * A model: the model's `get_absolute_url()` function will be called.

        * A view name, possibly with arguments: `urls.reverse()` will be used
          to reverse-resolve the name.

        * A URL, which will be returned as-is.
    Úget_absolute_url)z./z../)r   r   ú/ú.)	r"   rE   r)   r
   ÚstrÚ
startswithr	   r   Úcallable)r   r   r   s      r   r   r   œ   s”   € ô ˆrÐ%Ô&Ø×"Ñ"Ó$Ð$ä�"”gÔô �‹Wˆô �"”cÔ˜rŸ}™}¨]Ô;Øˆ	ðÜ�r ¨VÔ4Ð4øÜò ä�BŒ<Øà�b‰=˜S¨™]Øøð €Iðús   ÁA* Á*BÂB)NNNN)Ú__doc__Údjango.httpr   r   r   r   Údjango.templater   Údjango.urlsr   r	   Údjango.utils.functionalr
   r   r   r%   r5   r;   r@   rC   r   © r   r   ú<module>rQ      sV   ðñ÷ó õ #ß /Ý +ð QUó7ð #(¸%ô ò6
ò
ò8Yò"ò2ó"&r   