https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/django/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/django/__pycache__/shortcuts.cpython-310.pyc
o

3�a�@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 a 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�2/usr/lib/python3/dist-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_queryset,s

r cOsnt|�}t|d�st|t�r|jn|jj}td|��z	|j|i|��WS|jj	y6t
d|jjj��w)aX
    Use get() to return an object, or raise a 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_4049s
���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 a 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_404Qs
��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)rrrrrrrfs$

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

https://t.me/RX1948 - 2025