§
    Ÿjl2  ã                   óÊ   — d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ dd	lmZ  G d
„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        ZdS )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.
é    N)Ú
exceptions)ÚRemovedInDjango60Warning)Úcached_property)Úmake_hashableé   )ÚBLANK_CHOICE_DASH)ÚFieldCacheMixinc                   óØ  — e Zd ZdZdZdZdZdZdZdZ		 	 	 	 	 d$d„Z
ed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Zed	„ ¦   «         Zed
„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Zd„ Zd„ Zd„ Zd„ Zed„ ¦   «         Zd„ Zed„ ¦   «         Zd„ Zd„ Zd„ Zde ddfd„Z!d„ Z"d„ Z#d„ Z$d„ Z%ed„ ¦   «         Z&d%d „Z'd%d!„Z(ed"„ ¦   «         Z)ed#„ ¦   «         Z*dS )&Ú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.
    TFNc                 óŒ   — || _         || _        || _        || _        |€i n|| _        || _        || _        d| _        d| _        d S )NFT)	ÚfieldÚmodelÚrelated_nameÚrelated_query_nameÚlimit_choices_toÚparent_linkÚ	on_deleteÚsymmetricalÚmultiple)Úselfr   Útor   r   r   r   r   s           út/var/www/finuniver-perm.ru/html/student/venv/lib/python3.11/site-packages/django/db/models/fields/reverse_related.pyÚ__init__zForeignObjectRel.__init__*   sV   € ð ˆŒ
ØˆŒ
Ø(ˆÔØ"4ˆÔØ&6Ð&>  ÐDTˆÔØ&ˆÔØ"ˆŒà ˆÔØˆŒˆˆó    c                 óL   — t          | j        ¦  «        o| j        d         dk    S )z$Should the related object be hidden?éÿÿÿÿú+)Úboolr   ©r   s    r   ÚhiddenzForeignObjectRel.hiddenC   s'   € õ �DÔ%Ñ&Ô&ÐG¨4Ô+<¸RÔ+@ÀCÒ+GÐGr   c                 ó4   — | j                              ¦   «         S ©N)r   r   r   s    r   ÚnamezForeignObjectRel.nameH   s   € àŒz×,Ò,Ñ.Ô.Ð.r   c                 ó   — | j         S r"   )r   r   s    r   Úremote_fieldzForeignObjectRel.remote_fieldL   s
   € àŒzÐr   c                 ó„   — | j         d         j        }t          |¦  «        dk    rt          j        d¦  «        ‚|d         S )z�
        When filtering against this relation, return the field on the remote
        model against which the filtering should happen.
        r   r   z1Can't use target_field for multicolumn relations.r   )Ú
path_infosÚtarget_fieldsÚlenr   Ú
FieldError)r   r(   s     r   Útarget_fieldzForeignObjectRel.target_fieldP   sK   € ð œ¨Ô+Ô9ˆÝˆ}ÑÔ Ò!Ð!ÝÔ'ØCñô ð ð ˜QÔÐr   c                 óP   — | j         j        st          d¦  «        ‚| j         j        S )NzVThis property can't be accessed before self.field.contribute_to_class has been called.)r   r   ÚAttributeErrorr   s    r   Úrelated_modelzForeignObjectRel.related_model]   s3   € àŒzÔð 	Ý ð#ñô ð ð ŒzÔÐr   c                 ó   — | j         j        S r"   )r   Úmany_to_manyr   s    r   r0   zForeignObjectRel.many_to_manyf   s   € àŒzÔ&Ð&r   c                 ó   — | j         j        S r"   )r   Úone_to_manyr   s    r   Úmany_to_onezForeignObjectRel.many_to_onej   ó   € àŒzÔ%Ð%r   c                 ó   — | j         j        S r"   )r   r3   r   s    r   r2   zForeignObjectRel.one_to_manyn   r4   r   c                 ó   — | j         j        S r"   )r   Ú
one_to_oner   s    r   r7   zForeignObjectRel.one_to_oner   s   € àŒzÔ$Ð$r   c                 ó6   — | j                              |¦  «        S r"   )r   Ú
get_lookup)r   Úlookup_names     r   r9   zForeignObjectRel.get_lookupv   s   € ØŒz×$Ò$ [Ñ1Ô1Ð1r   c                 ó4   — | j                              ¦   «         S r"   )r   Úget_lookupsr   s    r   r<   zForeignObjectRel.get_lookupsy   s   € ØŒz×%Ò%Ñ'Ô'Ð'r   c                 ó6   — | j                              |¦  «        S r"   )r   Úget_transform)r   r#   s     r   r>   zForeignObjectRel.get_transform|   s   € ØŒz×'Ò'¨Ñ-Ô-Ð-r   c                 ó4   — | j                              ¦   «         S r"   )r   Úget_internal_typer   s    r   r@   z"ForeignObjectRel.get_internal_type   s   € ØŒz×+Ò+Ñ-Ô-Ð-r   c                 ó   — | j         j        S r"   )r   Údb_typer   s    r   rB   zForeignObjectRel.db_type‚   s   € àŒzÔ!Ð!r   c                 óz   — dt          | ¦  «        j        ›d| j        j        j        ›d| j        j        j        ›d�S )Nú<z: ú.ú>)ÚtypeÚ__name__r.   Ú_metaÚ	app_labelÚ
model_namer   s    r   Ú__repr__zForeignObjectRel.__repr__†   sD   € € å�‰JŒJÔÐÐØÔÔ$Ô.Ð.Ð.ØÔÔ$Ô/Ð/Ð/ð
ð 	
r   c           	      óŒ   — | j         | j        | j        | j        t	          | j        ¦  «        | j        | j        | j        | j	        f	S r"   )
r   r   r   r   r   r   r   r   r   r   r   s    r   ÚidentityzForeignObjectRel.identity�   sH   € ð ŒJØŒJØÔØÔ#Ý˜$Ô/Ñ0Ô0ØÔØŒNØÔØŒMð

ð 
	
r   c                 óZ   — t          || j        ¦  «        st          S | j        |j        k    S r"   )Ú
isinstanceÚ	__class__ÚNotImplementedrN   )r   Úothers     r   Ú__eq__zForeignObjectRel.__eq__›   s+   € Ý˜% ¤Ñ0Ô0ð 	"Ý!Ð!ØŒ} ¤Ò.Ð.r   c                 ó*   — t          | j        ¦  «        S r"   )ÚhashrN   r   s    r   Ú__hash__zForeignObjectRel.__hash__    s   € Ý�D”MÑ"Ô"Ð"r   c                 ód   — | j                              ¦   «         }|                     dd ¦  «         |S )Nr'   )Ú__dict__ÚcopyÚpop)r   Ústates     r   Ú__getstate__zForeignObjectRel.__getstate__£   s0   € Ø”×"Ò"Ñ$Ô$ˆð 	�	Š	�, Ñ%Ô%Ð%Øˆr   © c                 ó�   — |p| j         }| j        j                             |¦  «        }|r
 |j        |Ž }|r|ng d„ |D ¦   «         z   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.
        c                 ó:   — g | ]}|j         t          |¦  «        f‘ŒS r^   )ÚpkÚstr)Ú.0Úxs     r   ú
<listcomp>z0ForeignObjectRel.get_choices.<locals>.<listcomp>Á   s$   € Ð9UÐ9UÐ9UÈQ¸1¼4ÅÀQÁÄ¸.Ð9UÐ9UÐ9Ur   )r   r.   Ú_default_managerÚcomplex_filterÚorder_by)r   Úinclude_blankÚblank_choicer   ÚorderingÚqss         r   Úget_choiceszForeignObjectRel.get_choices¯   sf   € ð ,ÐD¨tÔ/DÐØÔÔ0×?Ò?Ð@PÑQÔQˆØð 	(Ø�”˜hÐ'ˆBØ -Ð5��°2Ð9UÐ9UÐRTÐ9UÑ9UÔ9UÑUÐUr   c                 ól   — t          j        dt          d¬¦  «         | j                             ¦   «         S )NzWForeignObjectRel.get_joining_columns() is deprecated. Use get_joining_fields() instead.é   )Ú
stacklevel)ÚwarningsÚwarnr   r   Úget_reverse_joining_columnsr   s    r   Úget_joining_columnsz$ForeignObjectRel.get_joining_columnsÃ   s<   € ÝŒð,å$Øð		
ñ 	
ô 	
ð 	
ð Œz×5Ò5Ñ7Ô7Ð7r   c                 ó4   — | j                              ¦   «         S r"   )r   Úget_reverse_joining_fieldsr   s    r   Úget_joining_fieldsz#ForeignObjectRel.get_joining_fieldsÌ   s   € ØŒz×4Ò4Ñ6Ô6Ð6r   c                 ó8   — | j                              ||¦  «        S r"   )r   Úget_extra_restriction)r   ÚaliasÚrelated_aliass      r   ry   z&ForeignObjectRel.get_extra_restrictionÏ   s   € ØŒz×/Ò/°¸uÑEÔEÐEr   c                 ó   — d| _         dS )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_namer   s    r   Úset_field_namezForeignObjectRel.set_field_nameÒ   s   € ð ˆŒˆˆr   c                 ó*   — |                       ¦   «         S r"   )Úget_accessor_namer   s    r   Úaccessor_namezForeignObjectRel.accessor_nameÜ   s   € à×%Ò%Ñ'Ô'Ð'r   c                 ó¶   — |r|j         n| j        j         }|p| j        }| j        r| j        r|| j        k    rd S | j        r| j        S |j        | j        rdndz   S )NÚ_setÚ )rI   r.   r   r   r   r   rK   )r   r   Úoptss      r   r€   z"ForeignObjectRel.get_accessor_nameà   s{   € ð $ÐAˆuŒ{ˆ{¨Ô);Ô)AˆØÐ+˜Ô+ˆØŒ=ð 	ð Ôð  E¨T¬ZÒ$7Ð$7Ø�tØÔð 	%ØÔ$Ð$ØŒ¨D¬MÐ"A & &¸rÑBÐBr   c                 óR   — |r| j                              |¦  «        S | j         j        S r"   )r   Úget_reverse_path_infoÚreverse_path_infos)r   Úfiltered_relations     r   Úget_path_infozForeignObjectRel.get_path_infoò   s,   € Øð 	1Ø”:×3Ò3Ð4EÑFÔFÐFà”:Ô0Ð0r   c                 ó*   — |                       ¦   «         S r"   )rŠ   r   s    r   r'   zForeignObjectRel.path_infosø   s   € à×!Ò!Ñ#Ô#Ð#r   c                 ó   — | j         S )z„
        Return the name of the cache key to use for storing an instance of the
        forward model on the reverse model.
        )r�   r   s    r   Ú
cache_namezForeignObjectRel.cache_nameü   s   € ð Ô!Ð!r   ©NNNFNr"   )+rH   Ú
__module__Ú__qualname__Ú__doc__Úauto_createdÚconcreteÚeditableÚis_relationÚnullÚempty_strings_allowedr   r   r    r#   Úpropertyr%   r+   r.   r0   r3   r2   r7   r9   r<   r>   r@   rB   rL   rN   rT   rW   r]   r   rm   rt   rw   ry   r~   r�   r€   rŠ   r'   r�   r^   r   r   r   r      sì  € € € € € ðð ð €LØ€HØ€HØ€Kð €DØ!Ðð ØØØØðð ð ð ð2 ðHð Hñ „_ðHð ð/ð /ñ „_ð/ð ðð ñ „Xðð ð
 ð 
 ñ „Xð
 ð ð ð  ñ „_ð ð ð'ð 'ñ „_ð'ð ð&ð &ñ „_ð&ð ð&ð &ñ „_ð&ð ð%ð %ñ „_ð%ð2ð 2ð 2ð(ð (ð (ð.ð .ð .ð.ð .ð .ð ð"ð "ñ „Xð"ð
ð 
ð 
ð ð
ð 
ñ „Xð
ð/ð /ð /ð
#ð #ð #ð
ð 
ð 
ð Ø&ØØðVð Vð Vð Vð(8ð 8ð 8ð7ð 7ð 7ðFð Fð Fðð ð ð ð(ð (ñ „_ð(ðCð Cð Cð Cð$1ð 1ð 1ð 1ð ð$ð $ñ „_ð$ð ð"ð "ñ „_ð"ð "ð "r   r   c                   ó^   ‡ — e Zd ZdZ	 	 	 	 	 d	ˆ fd„	Zˆ fd„Zeˆ fd„¦   «         Zd„ Zd„ Z	ˆ x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	           	      óf   •— t          ¦   «                              |||||||¬¦  «         || _        d S )N©r   r   r   r   r   )Úsuperr   r}   ©
r   r   r   r}   r   r   r   r   r   rQ   s
            €r   r   zManyToOneRel.__init__  sH   ø€ õ 	‰Œ×ÒØØØ%Ø1Ø-Ø#Øð 	ñ 	
ô 	
ð 	
ð %ˆŒˆˆr   c                 ót   •— t          ¦   «                              ¦   «         }|                     dd ¦  «         |S )Nr.   )r�   r]   r[   )r   r\   rQ   s     €r   r]   zManyToOneRel.__getstate__+  s1   ø€ Ý‘”×$Ò$Ñ&Ô&ˆØ�	Š	�/ 4Ñ(Ô(Ð(Øˆr   c                 ó<   •— t          ¦   «         j        | j        fz   S r"   )r�   rN   r}   ©r   rQ   s    €r   rN   zManyToOneRel.identity0  s   ø€ å‰wŒwÔ 4¤?Ð"4Ñ4Ð4r   c                 ó”   — | j         j                             | j        ¦  «        }|j        st          j        d| j        z  ¦  «        ‚|S )zY
        Return the Field in the 'to' object to which this relationship is tied.
        zNo related field named '%s')r   rI   Ú	get_fieldr}   r“   r   ÚFieldDoesNotExist)r   r   s     r   Úget_related_fieldzManyToOneRel.get_related_field4  sN   € ð ”
Ô ×*Ò*¨4¬?Ñ;Ô;ˆØŒ~ð 	ÝÔ.Ø-°´Ñ?ñô ð ð ˆr   c                 óJ   — | j         p| j        j        j        j        | _         d S r"   )r}   r   rI   ra   r#   r   s    r   r~   zManyToOneRel.set_field_name?  s   € Øœ/ÐE¨T¬ZÔ-=Ô-@Ô-EˆŒˆˆr   rŽ   )rH   r�   r�   r‘   r   r]   r˜   rN   r¥   r~   Ú__classcell__©rQ   s   @r   rš   rš     s»   ø€ € € € € ðð ð& ØØØØð%ð %ð %ð %ð %ð %ð.ð ð ð ð ð
 ð5ð 5ð 5ð 5ñ „Xð5ð	ð 	ð 	ðFð Fð Fð Fð Fð Fð Fr   rš   c                   ó.   ‡ — e Zd ZdZ	 	 	 	 	 dˆ fd„	Zˆ xZS )Ú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	           
      óh   •— t          ¦   «                              ||||||||¬¦  «         d| _        d S )Nrœ   F)r�   r   r   rž   s
            €r   r   zOneToOneRel.__init__K  sK   ø€ õ 	‰Œ×ÒØØØØ%Ø1Ø-Ø#Øð 	ñ 		
ô 		
ð 		
ð ˆŒˆˆr   rŽ   )rH   r�   r�   r‘   r   r§   r¨   s   @r   rª   rª   C  sX   ø€ € € € € ðð ð ØØØØðð ð ð ð ð ð ð ð ð r   rª   c                   óR   ‡ — e Zd ZdZ	 	 	 	 	 	 	 dˆ fd„	Zeˆ fd„¦   «         Zd„ Zˆ xZS )Ú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
                 óØ   •— t          ¦   «                              |||||¬¦  «         |r|	st          d¦  «        ‚|| _        |r|st          d¦  «        ‚|| _        || _        |	| _        d S )N)r   r   r   z4Can't supply a through model and db_constraint=Falsez5Cannot specify through_fields without a through model)r�   r   Ú
ValueErrorÚthroughÚthrough_fieldsr   Údb_constraint)r   r   r   r   r   r   r   r°   r±   r²   rQ   s             €r   r   zManyToManyRel.__init__l  sœ   ø€ õ 	‰Œ×ÒØØØ%Ø1Ø-ð 	ñ 	
ô 	
ð 	
ð ð 	U˜=ð 	UÝÐSÑTÔTÐTØˆŒàð 	V 'ð 	VÝÐTÑUÔUÐUØ,ˆÔà&ˆÔØ*ˆÔÐÐr   c                 ón   •— t          ¦   «         j        | j        t          | j        ¦  «        | j        fz   S r"   )r�   rN   r°   r   r±   r²   r¡   s    €r   rN   zManyToManyRel.identity‹  s5   ø€ å‰wŒwÔØŒLÝ˜$Ô-Ñ.Ô.ØÔð#
ñ 
ð 	
r   c                 óâ   — | j         j        }| j        r!|                     | j        d         ¦  «        }n/|j        D ]'}t          |dd¦  «        }|r|j        | j        k    r nŒ(|j        d         S )zŠ
        Return the field in the 'to' object to which this relationship is tied.
        Provided for symmetry with ManyToOneRel.
        r   r%   N)r°   rI   r±   r£   ÚfieldsÚgetattrr   Úforeign_related_fields)r   r…   r   Úrels       r   r¥   zManyToManyRel.get_related_field“  s€   € ð
 Œ|Ô!ˆØÔð 	Ø—N’N 4Ô#6°qÔ#9Ñ:Ô:ˆEˆEàœð ð �Ý˜e ^°TÑ:Ô:�Øð ˜3œ9¨¬
Ò2Ð2Ø�EøØÔ+¨AÔ.Ð.r   )NNNTNNT)	rH   r�   r�   r‘   r   r˜   rN   r¥   r§   r¨   s   @r   r­   r­   d  s’   ø€ € € € € ðð ð ØØØØØØð+ð +ð +ð +ð +ð +ð> ð
ð 
ð 
ð 
ñ „Xð
ð/ð /ð /ð /ð /ð /ð /r   r­   )r‘   rq   Údjango.corer   Údjango.utils.deprecationr   Údjango.utils.functionalr   Údjango.utils.hashabler   r„   r   Úmixinsr	   r   rš   rª   r­   r^   r   r   ú<module>r¾      sM  ðð	ð 	ð €€€à "Ð "Ð "Ð "Ð "Ð "Ø =Ð =Ð =Ð =Ð =Ð =Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø /Ð /Ð /Ð /Ð /Ð /à Ð Ð Ð Ð Ð Ø #Ð #Ð #Ð #Ð #Ð #ðk"ð k"ð k"ð k"ð k"�ñ k"ô k"ð k"ð\;Fð ;Fð ;Fð ;Fð ;FÐ#ñ ;Fô ;Fð ;Fð|ð ð ð ð �,ñ ô ð ðB</ð </ð </ð </ð </Ð$ñ </ô </ð </ð </ð </r   