Ë
    ¹ûàgR2  ã                   ó°   — 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y)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*y)&Ú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| _        y )NFT)	ÚfieldÚmodelÚrelated_nameÚrelated_query_nameÚlimit_choices_toÚparent_linkÚ	on_deleteÚsymmetricalÚmultiple)Úselfr   Útor   r   r   r   r   s           úe/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/django/db/models/fields/reverse_related.pyÚ__init__zForeignObjectRel.__init__*   sP   € ð ˆŒ
ØˆŒ
Ø(ˆÔØ"4ˆÔØ&6Ð&>¡ÐDTˆÔØ&ˆÔØ"ˆŒà ˆÔØˆ�ó    c                 óT   — t        | j                  «      xr | 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                 ó6   — | j                   j                  «       S ©N)r   r   r   s    r   ÚnamezForeignObjectRel.nameH   s   € à�z‰z×,Ñ,Ó.Ð.r   c                 ó   — | j                   S r"   )r   r   s    r   Úremote_fieldzForeignObjectRel.remote_fieldL   s   € à�z‰zÐr   c                 ó„   — | j                   d   j                  }t        |«      dkD  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   sH   € ð Ÿ™¨Ñ+×9Ñ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×ÒÜ ð#óð ð �z‰z×ÑÐr   c                 ó.   — | j                   j                  S r"   )r   Úmany_to_manyr   s    r   r0   zForeignObjectRel.many_to_manyf   s   € à�z‰z×&Ñ&Ð&r   c                 ó.   — | j                   j                  S r"   )r   Úone_to_manyr   s    r   Úmany_to_onezForeignObjectRel.many_to_onej   ó   € à�z‰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‰z×$Ñ$Ð$r   c                 ó8   — | j                   j                  |«      S r"   )r   Ú
get_lookup)r   Úlookup_names     r   r9   zForeignObjectRel.get_lookupv   s   € Ø�z‰z×$Ñ$ [Ó1Ð1r   c                 ó6   — | j                   j                  «       S r"   )r   Úget_lookupsr   s    r   r<   zForeignObjectRel.get_lookupsy   s   € Ø�z‰z×%Ñ%Ó'Ð'r   c                 ó8   — | j                   j                  |«      S r"   )r   Úget_transform)r   r#   s     r   r>   zForeignObjectRel.get_transform|   s   € Ø�z‰z×'Ñ'¨Ó-Ð-r   c                 ó6   — | j                   j                  «       S r"   )r   Úget_internal_typer   s    r   r@   z"ForeignObjectRel.get_internal_type   s   € Ø�z‰z×+Ñ+Ó-Ð-r   c                 ó.   — | j                   j                  S r"   )r   Údb_typer   s    r   rB   zForeignObjectRel.db_type‚   s   € à�z‰z×!Ñ!Ð!r   c                 ó¸   — 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__†   sC   � ä�‹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�   s\   € ð �J‰JØ�J‰JØ×ÑØ×#Ñ#Ü˜$×/Ñ/Ó0Ø×ÑØ�N‰NØ×ÑØ�M‰Mð

ð 
	
r   c                 ól   — t        || j                  «      st        S | j                  |j                  k(  S r"   )Ú
isinstanceÚ	__class__ÚNotImplementedrN   )r   Úothers     r   Ú__eq__zForeignObjectRel.__eq__›   s)   € Ü˜% §¡Ô0Ü!Ð!Ø�}‰} §¡Ñ.Ð.r   c                 ó,   — t        | j                  «      S r"   )ÚhashrN   r   s    r   Ú__hash__zForeignObjectRel.__hash__    s   € Ü�D—M‘MÓ"Ð"r   c                 ó^   — | j                   j                  «       }|j                  dd «       |S )Nr'   )Ú__dict__ÚcopyÚpop)r   Ústates     r   Ú__getstate__zForeignObjectRel.__getstate__£   s)   € Ø—‘×"Ñ"Ó$ˆð 	�	‰	�, Ô%Øˆr   © c                 óð   — |xs | j                   }| j                  j                  j                  |«      }|r |j                  |Ž }|r|ng |D �cg c]  }|j
                  t        |«      f‘Œ c}z   S c c}w )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.
        )r   r.   Ú_default_managerÚcomplex_filterÚorder_byÚpkÚstr)r   Úinclude_blankÚblank_choicer   ÚorderingÚqsÚxs          r   Úget_choiceszForeignObjectRel.get_choices¯   so   € ð ,ÒD¨t×/DÑ/DÐØ×Ñ×0Ñ0×?Ñ?Ð@PÓQˆÙØ�—‘˜hÐ'ˆBÙ -‘°2ÐRTÖ9UÈQ¸1¿4¹4ÄÀQÃº.Ò9UÑUÐUùÒ9Us   ÁA3c                 ój   — t        j                  dt        «       | j                  j	                  «       S )NzWForeignObjectRel.get_joining_columns() is deprecated. Use get_joining_fields() instead.)ÚwarningsÚwarnr   r   Úget_reverse_joining_columnsr   s    r   Úget_joining_columnsz$ForeignObjectRel.get_joining_columnsÃ   s+   € Ü�‰ð,ä$ô	
ð
 �z‰z×5Ñ5Ó7Ð7r   c                 ó6   — | j                   j                  «       S r"   )r   Úget_reverse_joining_fieldsr   s    r   Úget_joining_fieldsz#ForeignObjectRel.get_joining_fieldsË   s   € Ø�z‰z×4Ñ4Ó6Ð6r   c                 ó:   — | j                   j                  ||«      S r"   )r   Úget_extra_restriction)r   ÚaliasÚrelated_aliass      r   rt   z&ForeignObjectRel.get_extra_restrictionÎ   s   € Ø�z‰z×/Ñ/°¸uÓEÐEr   c                 ó   — d| _         y)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                 ó"   — | j                  «       S r"   )Úget_accessor_namer   s    r   Úaccessor_namezForeignObjectRel.accessor_nameÛ   s   € à×%Ñ%Ó'Ð'r   c                 ó(  — |r|j                   n| j                  j                   }|xs | j                  }| j                  r| j                  r|| j                  k(  ry | j
                  r| j
                  S |j                  | j                  rdz   S dz   S )NÚ_setÚ )rI   r.   r   r   r   r   rK   )r   r   Úoptss      r   r{   z"ForeignObjectRel.get_accessor_nameß   s   € ñ $ˆu�{Š{¨×);Ñ);×)AÑ)AˆØÒ+˜×+Ñ+ˆØ�=Š=ð ×Ò E¨T¯Z©ZÒ$7ØØ×ÒØ×$Ñ$Ð$Ø�‰¨D¯MªM &ÑBÐB¸rÑBÐBr   c                 óh   — |r| j                   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+   € ÙØ—:‘:×3Ñ3Ð4EÓFÐFà—:‘:×0Ñ0Ð0r   c                 ó"   — | j                  «       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   rj   ro   rr   rt   ry   r|   r{   r…   r'   rˆ   r^   r   r   r   r      s¶  „ ñð €LØ€HØ€HØ€Kð €DØ!Ðð ØØØØóð2 ñHó ðHð ñ/ó ð/ð ñó ðð ñ
 ó ð
 ð ñ ó ð ð ñ'ó ð'ð ñ&ó ð&ð ñ&ó ð&ð ñ%ó ð%ò2ò(ò.ò.ð ñ"ó ð"ò
ð ñ
ó ð
ò/ò
#ò
ð Ø&ØØóVò(8ò7òFòð ñ(ó ð(óCó$1ð ñ$ó ð$ð ñ"ó ñ"r   r   c                   óX   ‡ — 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.
    c	           	      ó@   •— t         ‰	| �  |||||||¬«       || _        y )N©r   r   r   r   r   )Úsuperr   rx   ©
r   r   r   rx   r   r   r   r   r   rQ   s
            €r   r   zManyToOneRel.__init__  s5   ø€ ô 	‰ÑØØØ%Ø1Ø-Ø#Øð 	ô 	
ð %ˆ�r   c                 óH   •— t         ‰| �  «       }|j                  dd «       |S )Nr.   )r˜   r]   r[   )r   r\   rQ   s     €r   r]   zManyToOneRel.__getstate__*  s#   ø€ Ü‘Ñ$Ó&ˆØ�	‰	�/ 4Ô(Øˆr   c                 ó4   •— t         ‰| �  | j                  fz   S r"   )r˜   rN   rx   ©r   rQ   s    €r   rN   zManyToOneRel.identity/  s   ø€ ä‰wÑ 4§?¡?Ð"4Ñ4Ð4r   c                 óÀ   — | j                   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_fieldrx   rŽ   r   ÚFieldDoesNotExist)r   r   s     r   Úget_related_fieldzManyToOneRel.get_related_field3  sO   € ð —
‘
× Ñ ×*Ñ*¨4¯?©?Ó;ˆØ�~Š~Ü×.Ñ.Ø-°·±Ñ?óð ð ˆr   c                 ó~   — | j                   xs* | j                  j                  j                  j                  | _         y r"   )rx   r   rI   rc   r#   r   s    r   ry   zManyToOneRel.set_field_name>  s(   € ØŸ/™/ÒE¨T¯Z©Z×-=Ñ-=×-@Ñ-@×-EÑ-Eˆ�r   r‰   )rH   rŠ   r‹   rŒ   r   r]   r“   rN   r    ry   Ú__classcell__©rQ   s   @r   r•   r•     sB   ø„ ñð& ØØØØõ%ô.ð
 ó5ó ð5ò	ö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.
    c	           
      óB   •— t         ‰	| �  ||||||||¬«       d| _        y )Nr—   F)r˜   r   r   r™   s
            €r   r   zOneToOneRel.__init__J  s8   ø€ ô 	‰ÑØØØØ%Ø1Ø-Ø#Øð 	ô 		
ð ˆ�r   r‰   )rH   rŠ   r‹   rŒ   r   r¢   r£   s   @r   r¥   r¥   B  s#   ø„ ñð ØØØØ÷ñ r   r¥   c                   óL   ‡ — 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.
    c
                 ó¢   •— t         ‰
| �  |||||¬«       |r|	st        d«      ‚|| _        |r|st        d«      ‚|| _        || _        |	| _        y )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__k  si   ø€ ô 	‰ÑØØØ%Ø1Ø-ð 	ô 	
ñ ™=ÜÐSÓTÐTØˆŒá¡'ÜÐTÓUÐUØ,ˆÔà&ˆÔØ*ˆÕr   c                 ór   •— t         ‰| �  | j                  t        | j                  «      | j
                  fz   S r"   )r˜   rN   r«   r   r¬   r­   rœ   s    €r   rN   zManyToManyRel.identityŠ  s8   ø€ ä‰wÑØ�L‰LÜ˜$×-Ñ-Ó.Ø×Ñð#
ñ 
ð 	
r   c                 ó  — | j                   j                  }| j                  r|j                  | j                  d   «      }n<|j                  D ]-  }t        |dd«      }|sŒ|j                  | j                  k(  sŒ- 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Ñ#6°qÑ#9Ó:‰EàŸ™ò �Ü˜e ^°TÓ:�Ú˜3Ÿ9™9¨¯
©
Ó2Ùðð ×+Ñ+¨AÑ.Ð.r   )NNNTNNT)	rH   rŠ   r‹   rŒ   r   r“   rN   r    r¢   r£   s   @r   r¨   r¨   c  s=   ø„ ñð ØØØØØØõ+ð> ó
ó ð
ö/r   r¨   )rŒ   rl   Údjango.corer   Údjango.utils.deprecationr   Údjango.utils.functionalr   Údjango.utils.hashabler   r   r   Úmixinsr	   r   r•   r¥   r¨   r^   r   r   ú<module>r¹      sZ   ðñ	ó å "Ý =Ý 3Ý /å Ý #ôj"�ô j"ôZ;FÐ#ô ;Fô|�,ô ôB</Ð$õ </r   