HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberPanel/lib64/python3.10/site-packages/django/__pycache__/shortcuts.cpython-310.pyc
o

��h��@s�dZddlmZmZmZmZddlmZddlm	Z	m
Z
ddlmZ	ddd�Z
d	d
�dd�Zd
d�Zdd�Zdd�Zdd�ZdS)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)�PromiseNcCstj||||d�}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
�content�r�F/usr/local/CyberPanel/lib/python3.10/site-packages/django/shortcuts.py�rendersrF)�	permanentcOs&|rtnt}|t|g|�Ri|���S)a�
    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; pass permanent=True to issue a
    permanent redirect.
    )rr�resolve_url)�tor�args�kwargs�redirect_classrrr�redirects
�rcCst|d�r
|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)�klassrrr�
_get_queryset3s

r cOsnt|�}t|d�st|t�r|jn|jj}td|��z	|j|i|��WS|jj	y6t
d|jjj��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)rrr�queryset�klass__namerrr�get_object_or_404@s 
�����r.cOsdt|�}t|d�st|t�r|jn|jj}td|��t|j|i|���}|s0t	d|j
jj��|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 rr#r$r%r&r'�listr/rr(r*r+)rrrr,r-�obj_listrrr�get_list_or_404\s
����r2cOs�t|d�r	|��St|t�rt|�}t|t�r|�d�r|Szt|||d�WStyAt|�r2�d|vr;d|vr>�Y|SY|Sw)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../)rr�/�.)	rr3r#r	�str�
startswithrr�callable)rrrrrrrus$

���r)NNNN)�__doc__�django.httprrrr�django.templater�django.urlsrr�django.utils.functionalr	rrr r.r2rrrrr�<module>s
�