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/db/models/fields/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/django/db/models/fields/__pycache__/reverse_related.cpython-310.pyc
o

3�a�+�@s�dZddlmZddlmZddlmZddlmZddl	m
Z
Gdd	�d	e
�ZGd
d�de�ZGdd
�d
e�Z
Gdd�de�ZdS)al
"Rel objects" for related fields.

"Rel objects" (for lack of a better name) carry information about the relation
modeled by a related field and provide some utility functions. They're stored
in the ``remote_field`` attribute of the field.

They also act as reverse fields for the purposes of the Meta API because
they're the closest concept currently available.
�)�
exceptions)�cached_property)�
make_hashable�)�BLANK_CHOICE_DASH)�FieldCacheMixinc@s0eZdZdZdZdZdZdZdZdZ			d8dd�Z
edd��Zed	d
��Z
edd��Zed
d��Zedd��Zedd��Zedd��Zedd��Zedd��Zdd�Zdd�Zedd��Zdd �Zed!d"��Zd#d$�Zd%d&�Zdedd'fd(d)�Zd*d+�Zd,d-�Z d.d/�Z!d0d1�Z"d9d2d3�Z#d9d4d5�Z$d6d7�Z%dS):�ForeignObjectRelz�
    Used by ForeignObject to store information about the relation.

    ``_meta.get_fields()`` returns this class to provide access to the field
    flags for the reverse relation.
    TFNcCsF||_||_||_||_|durin||_||_||_d|_d|_dS)NFT)	�field�model�related_name�related_query_name�limit_choices_to�parent_link�	on_delete�symmetrical�multiple)�selfr	�torrr
rr�r�I/usr/lib/python3/dist-packages/django/db/models/fields/reverse_related.py�__init__'s
zForeignObjectRel.__init__cC�|��S�N)�	is_hidden�rrrr�hidden8�zForeignObjectRel.hiddencC�
|j��Sr)r	rrrrr�name<s
zForeignObjectRel.namecCs|jSr)r	rrrr�remote_field@szForeignObjectRel.remote_fieldcCs,|��dj}t|�dkrt�d��|dS)z�
        When filtering against this relation, return the field on the remote
        model against which the filtering should happen.
        ���rz1Can't use target_field for multicolumn relations.r)�
get_path_info�
target_fields�lenr�
FieldError)rr"rrr�target_fieldDs
zForeignObjectRel.target_fieldcCs|jjstd��|jjS)NzVThis property can't be accessed before self.field.contribute_to_class has been called.)r	r
�AttributeErrorrrrr�
related_modelOs
�zForeignObjectRel.related_modelcC�|jjSr)r	�many_to_manyrrrrr)VrzForeignObjectRel.many_to_manycCr(r)r	�one_to_manyrrrr�many_to_oneZrzForeignObjectRel.many_to_onecCr(r)r	r+rrrrr*^rzForeignObjectRel.one_to_manycCr(r)r	�
one_to_onerrrrr,brzForeignObjectRel.one_to_onecC�|j�|�Sr)r	�
get_lookup)r�lookup_namerrrr.f�zForeignObjectRel.get_lookupcCrr)r	�get_internal_typerrrrr1i�
z"ForeignObjectRel.get_internal_typecCr(r)r	�db_typerrrrr3lrzForeignObjectRel.db_typecCs dt|�j|jjj|jjjfS)Nz<%s: %s.%s>)�type�__name__r'�_meta�	app_label�
model_namerrrr�__repr__ps
�zForeignObjectRel.__repr__c	Cs,|j|j|j|jt|j�|j|j|j|j	f	Sr)
r	r
rrrr
rrrrrrrr�identityws�zForeignObjectRel.identitycCst||j�stS|j|jkSr)�
isinstance�	__class__�NotImplementedr:)r�otherrrr�__eq__�szForeignObjectRel.__eq__cCs
t|j�Sr)�hashr:rrrr�__hash__�r2zForeignObjectRel.__hash__rcCs@|p|j}|jj�|�}|r|j|�}|r|ngdd�|D�S)a
        Return choices with a default blank choices included, for use
        as <select> choices for this field.

        Analog of django.db.models.fields.Field.get_choices(), provided
        initially for utilization by RelatedFieldListFilter.
        cSsg|]	}|jt|�f�qSr)�pk�str)�.0�xrrr�
<listcomp>�s�z0ForeignObjectRel.get_choices.<locals>.<listcomp>)r
r'�_default_manager�complex_filter�order_by)r�
include_blank�blank_choicer
�ordering�qsrrr�get_choices�s

�zForeignObjectRel.get_choicescCst|j�o|jddkS)z$Should the related object be hidden?r �+)�boolrrrrrr�szForeignObjectRel.is_hiddencCrr)r	�get_reverse_joining_columnsrrrr�get_joining_columns�r2z$ForeignObjectRel.get_joining_columnscCs|j�|||�Sr)r	�get_extra_restriction)r�where_class�alias�
related_aliasrrrrS�sz&ForeignObjectRel.get_extra_restrictioncCs
d|_dS)z�
        Set the related field's name, this is not available until later stages
        of app loading, so set_field_name is called from
        set_attributes_from_rel()
        N)�
field_namerrrr�set_field_name�s
zForeignObjectRel.set_field_namecCsX|r|jn|jj}|p
|j}|jr|jr||jkrdS|jr!|jS|j|jr)dSdS)N�_set�)r6r'rrr
rr8)rr
�optsrrr�get_accessor_name�s
z"ForeignObjectRel.get_accessor_namecCr-r)r	�get_reverse_path_info)r�filtered_relationrrrr!�r0zForeignObjectRel.get_path_infocCr)z�
        Return the name of the cache key to use for storing an instance of the
        forward model on the reverse model.
        )r\rrrr�get_cache_name�szForeignObjectRel.get_cache_name�NNNFNr)&r5�
__module__�__qualname__�__doc__�auto_created�concrete�editable�is_relation�null�empty_strings_allowedrrrr�propertyrr%r'r)r+r*r,r.r1r3r9r:r?rArrNrrRrSrXr\r!r_rrrrrs`
�













�


rcsNeZdZdZ		d�fdd�	Zdd�Ze�fdd	��Zd
d�Zdd
�Z	�Z
S)�ManyToOneRela+
    Used by the ForeignKey field to store information about the relation.

    ``_meta.get_fields()`` returns this class to provide access to the field
    flags for the reverse relation.

    Note: Because we somewhat abuse the Rel objects by using them as reverse
    fields we get the funny situation where
    ``ManyToOneRel.many_to_one == False`` and
    ``ManyToOneRel.one_to_many == True``. This is unfortunate but the actual
    ManyToOneRel class is a private API and there is work underway to turn
    reverse relations into actual fields.
    NFc			s$t�j|||||||d�||_dS)N�rrr
rr)�superrrW�	rr	rrWrrr
rr�r<rrr�s�
	zManyToOneRel.__init__cCs|j��}|�dd�|S)Nr')�__dict__�copy�pop)r�staterrr�__getstate__�s
zManyToOneRel.__getstate__cst�j|jfSr)rmr:rWrrorrr:�szManyToOneRel.identitycCs*|jj�|j�}|jst�d|j��|S)zY
        Return the Field in the 'to' object to which this relationship is tied.
        zNo related field named '%s')r
r6�	get_fieldrWrer�FieldDoesNotExist)rr	rrr�get_related_field�szManyToOneRel.get_related_fieldcCs|jp|jjjj|_dSr)rWr
r6rBrrrrrrX�szManyToOneRel.set_field_namer`)r5rarbrcrrtrjr:rwrX�
__classcell__rrrorrk�s�
	rkcs&eZdZdZ		d�fdd�	Z�ZS)�OneToOneRelz�
    Used by OneToOneField to store information about the relation.

    ``_meta.get_fields()`` returns this class to provide access to the field
    flags for the reverse relation.
    NFc		
s&t�j||||||||d�d|_dS)NrlF)rmrrrnrorrr
s�
	zOneToOneRel.__init__r`)r5rarbrcrrxrrrorrys
�rycs@eZdZdZ			d
�fdd�	Ze�fdd��Zdd	�Z�ZS)�
ManyToManyRelz�
    Used by ManyToManyField to store information about the relation.

    ``_meta.get_fields()`` returns this class to provide access to the field
    flags for the reverse relation.
    NTc

sRt�j|||||d�|r|	std��||_|r|std��||_||_|	|_dS)N)rrr
z4Can't supply a through model and db_constraint=Falsez5Cannot specify through_fields without a through model)rmr�
ValueError�through�through_fieldsr�
db_constraint)
rr	rrrr
rr|r}r~rorrr s�
zManyToManyRel.__init__cst�j|jt|j�|jfSr)rmr:r|rr}r~rrorrr:5s
�zManyToManyRel.identitycCsV|jj}|jr|�|jd�}n|jD]}t|dd�}|r%|j|jkr%nq|jdS)z�
        Return the field in the 'to' object to which this relationship is tied.
        Provided for symmetry with ManyToOneRel.
        rrN)r|r6r}ru�fields�getattrr
�foreign_related_fields)rr[r	�relrrrrw=s
�
zManyToManyRel.get_related_field)NNNTNNT)	r5rarbrcrrjr:rwrxrrrorrzs�rzN)rc�django.corer�django.utils.functionalr�django.utils.hashablerrZr�mixinsrrrkryrzrrrr�<module>s=2

https://t.me/RX1948 - 2025