+
    Tj                     r   ^ RI t ^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RI
Ht ^ RIHt ^ R	IHt ^ R
IHt ^ RIHtHt ^ RIHt ^ RIHt ^ RIHtHt ^ RIHt ^ RI H!t! ^ RI"H#t# ^ RI$H%t% ^RI&H't' ^RI(H)t) R!R lt*R t+R t,R t- ! R R4      t. ! R R]	4      t/ ! R R]4      t0 ! R R 4      t1R# )"    N)defaultdict)contextmanager)partial)	AppConfig)Apps)apps)settings)FieldDoesNotExist)models)field_is_referencedget_references)NOT_PROVIDED)RECURSIVE_RELATIONSHIP_CONSTANT)DEFAULT_NAMESnormalize_together)make_model_tuple)cached_property)import_string)get_docs_version)InvalidBasesError)resolve_relationc                     \        V \        4      '       d8   V P                  R ^4      p\        V4      ^8X  d   \	        V4      # W^ ,          3# V P
                  P                  V P
                  P                  3# ).)
isinstancestrsplitlentuple_meta	app_label
model_name)modelr    r   s   && O/var/www/idalgo/venv/lib/python3.14/site-packages/django/db/migrations/state.py_get_app_label_and_model_namer$      s^    %C#"5zQuU|IYa4II{{$$ekk&<&<<<    c                d   V P                  4        Uu. uF'  p\        V\        P                  4      '       g   K%  VNK)  	  pp\	        4       pV P
                  P                  RRR7       F  pVP                  '       g   K  VP                  f   K'  \        VP                  \        4      '       d   KI  VP                  VP                  4       VP                  VP                  4       K  	  V P
                  pVP                  '       d"   W9   d   VP                  VP                  4       V# u upi )zEReturn all models that have a direct relationship to the given model.T)include_parentsinclude_hidden)__subclasses__
issubclassr   Modelsetr   
get_fieldsis_relationrelated_modelr   r   addr"   appendproxyconcrete_model)msubclassrelated_modelsrelated_fields_modelsfoptss   &     r#   _get_related_modelsr:   "   s     ((**Hh- 	*  
  EWWTJMMM+q44!%%agg.!!!//2 K 77Dzzza0d112's
   "D-D-c                    \        V 4       Uu0 uF/  pVP                  P                  VP                  P                  3kK1  	  up# u upi )ze
Return a list of typical (app_label, model_name) tuples for all related
models for the given model.
)r:   r   r    r!   )r"   rel_mods   & r#   get_related_models_tuplesr=   :   sG     +511G 
	 	 '--":":;1  s   5Ac                f   \        4       p\        V 4      pV Fd  pVP                  P                  VP                  P                  rTWE3V9   d   K8  VP                  WE34       VP                  \        V4      4       Kf  	  WP                  P                  V P                  P                  30,
          # )a  
Return all models that have a direct or indirect relationship
to the given model.

Relationships are either defined by explicit relational fields, like
ForeignKey, ManyToManyField or OneToOneField, or by inheriting from another
model (a superclass is related to its subclasses, but not vice versa).
Note, however, that a model inheriting from a concrete model is also
related to its superclass through the implicit *_ptr OneToOneField on the
subclass.
)r,   r:   r   r    r!   r0   extend)r"   seenqueuer<   rel_app_labelrel_model_names   &     r#   get_related_models_recursiverD   E   s     5D&EMM##MM$$ & *d2-01(12  KK))5;;+A+ABCCCr%   c                   <  a  ] tR t^_t o RtR)R lt]R 4       tR tR t	R t
R*R ltR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR+R ltR+R ltR,R ltR tR tR*R lt R*R lt!R t"R  t#R! t$R" t%R# t&R$ t'](R% 4       t)]*R& 4       t+R' t,R(t-V t.R# )-ProjectStatez
Represent the entire project's overall state. This is the item that is
passed around - do it here rather than at the app level so that cross-app
FKs/etc. resolve properly.
Nc                    T;'       g    / V n         Vf   \        4       pM\        V\        4      '       g   Q hW n        RV n        R V n        R # )NF)r   r,   r   	real_apps
is_delayed
_relations)selfr   rH   s   &&&r#   __init__ProjectState.__init__f   sB    llIi----"r%   c                V    V P                   f   V P                  4        V P                   # N)rJ   resolve_fields_and_relationsrK   s   &r#   	relationsProjectState.relationsr   s"    ??"--/r%   c                    VP                   VP                  3pWP                  V&   V P                  e   V P	                  V4       RV P
                  9   d   V P                  ! V!   R # R # Nr   )r    
name_lowerr   rJ   resolve_model_relations__dict__reload_model)rK   model_state	model_keys   && r#   	add_modelProjectState.add_modelx   s[    ));+A+AA	!,I??&((3T]]"y) #r%   c                   W3pV P                   V V P                  er   V P                  P                  VR 4       \        V P                  P	                  4       4       F.  w  rEVP                  VR 4       V'       d   K!  V P                  V K0  	  RV P
                  9   d7   V P                  P                  ! V!   V P                  P                  4        R # R # rU   )	r   rJ   poplistitemsrX   r   unregister_modelclear_cache)rK   r    r!   r[   related_model_keymodel_relationss   &&&   r#   remove_modelProjectState.remove_model   s    )	KK	"??&OO	406:4??;P;P;R6S2!##It4&(9: 7T T]]"II&&	2 II!!#	 #r%   c                   VP                  4       pVP                  4       pV P                  W3,          P                  4       pW6n        W`P                  W3&   W3pV R V 2p\	        4       p	\        W4       F  w  rrRpVP                  '       d!   VP                  4       pWP                  n        VP                  '       d%   Vf   VP                  4       pWP                  n	        V'       g   Kz  WP                  V&   V	P                  V
P                  V
P                  34       K  	  V P                  e}   W3pW3pWP                  9   d)   V P                  P                  V4      V P                  V&   V P                  P!                  4        F   pVV9   g   K  VP                  V4      VV&   K"  	  V P#                  V	RR7       V P%                  W4       V P'                  WRR7       R# )r   NTdelay)lowerr   clonenamer,   r   toremote_fieldr"   throughfieldsr0   r    rV   rJ   r_   valuesreload_modelsrf   rY   )rK   r    old_namenew_nameold_name_lowernew_name_lowerrenamed_modelold_model_tuplenew_remote_model	to_reloadrZ   rm   field	referencechanged_fieldold_name_keynew_name_keyre   s   &&&&              r#   rename_modelProjectState.rename_model   s   !)!)I$=>DDF%1>I-.$5'[(4E	3A4
/Ku !M||| %3C**0    ($)KKMM5E**2}+8""4({44k6L6LMN4
 ??&$4L$4L.040C0CL0Q-#'??#9#9#;?24C4G4G4UOL1 $< 	9D1)4)4@r%   c                    V P                   W3,          p/ VP                  CVCVn        V'       d.   V F'  pWc9  g   K  VP                  P                  VR 4       K)  	  V P                  WRR7       R# )FTri   N)r   optionsr_   rY   )rK   r    r!   r   option_keysrZ   keys   &&&&&  r#   alter_model_options ProjectState.alter_model_options   si    kk)"78@!4!4@@"%''++C7 # 	)t<r%   c                   V P                   W3,          pVP                  P                  V4      ;p'       d;   V Uu. uF   p\        V4      \        V4      8w  g   K  VNK"  	  upVP                  V&   V P	                  WR R7       R# u upi Tri   N)r   r   getr   rY   )rK   r    r!   option_namevalue_to_removerZ   objsobjs   &&&&&   r#   remove_model_options!ProjectState.remove_model_options   s    kk)"78&&**;7747#0#uSzU?5K'Kt0K, 	)t<0s   BBc                t    V P                   W3,          p\        V4      Vn        V P                  WR R7       R# r   )r   r`   managersrY   )rK   r    r!   r   rZ   s   &&&& r#   alter_model_managers!ProjectState.alter_model_managers   s2    kk)"78#H~)t<r%   c                    V P                   W3,          p. VP                  V,          OVNVP                  V&   V P                  WR R7       R# r   )r   r   rY   )rK   r    r!   r   r   rZ   s   &&&&& r#   _append_optionProjectState._append_option   sK    kk)"78+S[-@-@-M+Ss+SK()t<r%   c                    V P                   W3,          pVP                  V,          pV Uu. uF  qwP                  V8w  g   K  VNK  	  upVP                  V&   V P                  WR R7       R# u upi r   r   r   rm   rY   )rK   r    r!   r   obj_namerZ   r   r   s   &&&&&   r#   _remove_optionProjectState._remove_option   sf    kk)"78"";/;?+X4C88xCWCC4+XK()t< ,Ys   A.A.c                    V P                   W3,          pVP                  V,          pV Uu. uF  qP                  V8w  d   TMTNK  	  upVP                  V&   V P                  WR R7       R# u upi r   r   )	rK   r    r!   r   r   alt_objrZ   r   r   s	   &&&&&&   r#   _alter_optionProjectState._alter_option   so    kk)"78"";/@D,
@D88x'CW4,
K( 	)t<,
s   A.c                ,    V P                  WR V4       R# indexesNr   )rK   r    r!   indexs   &&&&r#   	add_indexProjectState.add_index   s    I9eDr%   c                ,    V P                  WR V4       R# r   r   )rK   r    r!   
index_names   &&&&r#   remove_indexProjectState.remove_index   s    I9jIr%   c                   V P                   W3,          pVP                  R ,          p. pV F;  pVP                  V8X  d   VP                  4       pWHn        VP	                  V4       K=  	  WuP                  R &   V P                  WRR7       R# )r   Tri   N)r   r   rm   rl   r1   rY   )	rK   r    r!   old_index_namenew_index_namerZ   r   new_indexesr   s	   &&&&&    r#   rename_indexProjectState.rename_index   s    kk)"78""9-Cxx>)iik)s#	  *5I&)t<r%   c                ,    V P                  WR V4       R# constraintsNr   )rK   r    r!   
constraints   &&&&r#   add_constraintProjectState.add_constraint   s    I=*Mr%   c                ,    V P                  WR V4       R# r   r   )rK   r    r!   constraint_names   &&&&r#   remove_constraintProjectState.remove_constraint   s    I=/Rr%   c                ,    V P                  WR W44       R# r   )r   )rK   r    r!   r   r   s   &&&&&r#   alter_constraintProjectState.alter_constraint   s    =/	
r%   c                   V'       g   VP                  4       p\        Vn        MTpW3pW@P                  V,          P                  V&   V P
                  e   V P                  WcV4       VP                  '       * pV P                  ! VRV/  R # Nrj   )	rl   r   defaultr   rq   rJ   resolve_model_field_relationsr.   rY   )rK   r    r!   rm   r|   preserve_defaultr[   rj   s   &&&&&&  r#   	add_fieldProjectState.add_field   sv    KKME(EME)	.3I%%d+??&..yF%%%92E2r%   c                    W3pV P                   V,          pVP                  P                  V4      pV P                  e   V P	                  WCV4       VP
                  '       * pV P                  ! VRV/  R # r   )r   rq   r_   rJ   r   r.   rY   )rK   r    r!   rm   r[   rZ   	old_fieldrj   s   &&&&    r#   remove_fieldProjectState.remove_field  si    )	kk),&&**40	??&..y	J)))92E2r%   c                   V'       g   VP                  4       p\        Vn        MTpW3pV P                  V,          P                  pV P
                  e_   VP                  V4      pVP                  '       d   V P                  WcV4       WGV&   VP                  '       d   V P                  WcV4       MWGV&   VP                  '       * ;'       d    \        WW434      '       * p	V P                  ! VRV	/  R # r   )rl   r   r   r   rq   rJ   r_   r.   r   r   rY   )
rK   r    r!   rm   r|   r   r[   rq   r   rj   s
   &&&&&&    r#   alter_fieldProjectState.alter_field  s    KKME(EME)	Y'..??&

4(I$$$229IN 4L   229EJ 4L
 %%% 
 
.Ad]/
 +
 	92E2r%   c           
     0   W3pV P                   V,          pVP                  p VP                  V4      pYT&   TP                  4        F  p	\        T	RR4      p
T
'       d)   \        T
 Uu. uF  pY8X  d   TMTNK  	  up4      T	n        \        T	RR4      ;p'       g   KW  Y<9   g   K_  \        T	P                   Uu. uF  pY8X  d   TMTNK  	  up4      T	n	        K  	  TP                  pR
 F@  pY9   g   K  Y,           UUu. uF  pT Uu. uF  pTT8X  d   TMTNK  	  upNK   	  uppY&   KB  	  Rp\        YY834      pT Fx  Ev pp	pRpTP                  '       g   K  TP                  w  pp\        TRR4      T8X  d   TTn        T'       g   KO  \        T Uu. uF  pTT8X  d   TMTNK  	  up4      T	n        Kz  	  T P                  e}   TP!                  4       pTP!                  4       pT P                  P                  4        F>  pTTT,          9   g   K  TT,          P                  T4      p	TT	n        T	TT,          T&   K@  	  T P$                  ! TR	T/  R#   \         d    \	        T R T RT R24      hi ; iu upi u upi u upi u uppi u upi )r   z has no field named ''from_fieldsNfield_namesTF
field_namerj   )index_togetherunique_together)r   rq   r_   KeyErrorr
   rr   getattrr   r   r   r   r   rn   r   	to_fieldsrJ   rk   rm   rY   )rK   r    r!   rt   ru   r[   rZ   rq   foundr|   r   from_field_namer   r   r   optiontogethernrj   
references_r}   ro   r   to_field_namerv   rw   to_models   &&&&&                       r#   rename_fieldProjectState.rename_field2  s   )	kk),##	JJx(E
 !x]]_E!%=K$) 0;/:O %4$?_T/:%! &e]DAA{AA*(- /4.?.?.?
 )3(>HJN.?)E% %* %%;F  %,O#$3 @HHx!hXA5xH$3# < #Dh5FG
$. QyE|||*3,,'i<t<H.6L+9&+ 2;1: )6(AH}T1:'EO %/ ??&%^^-N%^^-N OO224!Xi%88$Y/33NCE!/EJ:?HY'7	 5
 	92E2s  	#+Qzl*?zK 	 I#s5   I *I>
;J
	JJJJ
 I;Jc                `   V'       d   R V n         \        4       p V P                  P                  W4      pV'       d   \	        V4      pM\        V4      p V P                  W3,          p\        4       pVP                  P                  4        Fp  pVP                  '       g   K  VP                  P                  \        8X  d   K8  \        VP                  V4      w  rVP!                  WP#                  4       34       Kr  	  VP%                  V4       V F_  w  r V P                  P                  W4      pV'       d   VP%                  \	        V4      4       KE  VP%                  \        V4      4       Ka  	  VP!                  W34       V#   \         d     ELDi ; i  \         d     K  i ; iT)rI   r,   r   	get_modelr=   rD   LookupErrorr   rq   rr   r.   ro   r"   r   r$   r/   r0   rk   update)rK   r    r!   rj   r6   	old_modelrZ   direct_related_modelsr|   rB   rC   	rel_models   &&&&        r#   _find_reload_modelProjectState._find_reload_modelt  s{   "DO
	I		++IBI !:9!E!=i!H kk9"9: !$ ''..0E   %%++/NN0M''1- &))=:N:N:P*QR 1 	34-B)MS II//N	 "))*CI*NO"))*Fy*QR .C 	I23Q  		:  s#   F FFFF-,F-c                r    R V P                   9   d&   V P                  WV4      pV P                  V4       R# R# r   N)rX   r   _reload)rK   r    r!   rj   r6   s   &&&& r#   rY   ProjectState.reload_model  s1    T]]"!44YERNLL( #r%   c                    R V P                   9   dJ   \        4       pV F&  w  rEVP                  V P                  WEV4      4       K(  	  V P	                  V4       R# R# r   )rX   r,   r   r   r   )rK   r   rj   r6   r    r!   s   &&&   r#   rs   ProjectState.reload_models  sS    T]]" UN)/%	%%++I5I *0 LL( #r%   c                (   V P                   P                  4       ;_uu_ 4        V F   w  r#V P                   P                  W#4       K"  	  R R R 4       . pV P                   P                   F3  pVP                  VP
                  3V9   g   K"  VP                  V4       K5  	  V F+  w  r# V P                  W#3,          pVP                  V4       K-  	  V P                   P                  V4       R #   + '       g   i     L; i  \         d     Km  i ; irO   )
r   bulk_updaterb   real_modelsr    rV   r1   r   r   render_multiple)rK   r6   rB   rC   states_to_be_renderedrZ   s   &&    r#   r   ProjectState._reload  s    YY""$$1?-		**=I 2@ % !#  9900K%%{'='=>.P%,,[9 1
 .<)M:"kk-*GH &,,[9 .< 			!!"78- %$   s   'C/)D/C?	DDc                B   \        V.VO5!  pV^ ,          V P                  9  d   We9   d	   WV,          pV P                  V,          pW0P                  V,          P                  9   d   W7V,          9  g   Q hWGV,          V&   R# Wr,          V Wr,          '       g   Wr R# R# )r   N)r   rH   rJ   r   rq   )rK   r"   r[   r   r|   	concretesremote_model_keyrelations_to_remote_models   &&&&&&  r#   update_model_field_relation(ProjectState.update_model_field_relation  s     ,E>I>Adnn49I9V(:$(OO4D$E!Y/666 y%IIII?Di0<)4Z@,77-8 8r%   c                    VP                   pV'       g   R # Vf   V P                  4       w  rFV P                  VP                  VVVV4       \	        VRR 4      pV'       g   R # V P                  WqW#V4       R # )Nrp   )ro   -_get_concrete_models_mapping_and_proxy_modelsr   r"   r   )rK   r[   r   r|   r   ro   r   rp   s   &&&&&   r#   r   *ProjectState.resolve_model_field_relations  sy     ))MMOLI((	
 ,	48((
9	
r%   c                    Vf   V P                  4       w  r#V P                  V,          pVP                  P                  4        F  w  rVV P	                  WWb4       K  	  R # rO   )r  r   rq   ra   r   )rK   r[   r   r   rZ   r   r|   s   &&&    r#   rW   $ProjectState.resolve_model_relations  sR    MMOLIkk),!,!3!3!9!9!;J..yeW "<r%   c                   V P                   P                  4        F,  pVP                  P                  4        F  w  r#W#n        K  	  K.  	  \        \        \
        \        4      4      V n        V P                  4       w  rEV F  pV P                  Wd4       K  	  V F)  pV P                  WF,          ,          V P                  V&   K+  	  R # rO   )r   rr   rq   ra   rm   r   r   dictrJ   r  rW   )rK   rZ   r   r|   r   proxiesr[   s   &      r#   rP   )ProjectState.resolve_fields_and_relations	  s    ;;--/K%0%7%7%=%=%?!
'
 &@ 0
 &gk4&@A!OOQ	"I((> # !I)-9M)NDOOI& !r%   c                N    V P                  4       w  pp\        V4      pW$,          # rO   )r  r   )rK   r"   concrete_models_mappingr   r[   s   &&   r#   get_concrete_model_key#ProjectState.get_concrete_model_key  s.     >>@	
#$U+	&11r%   c                    / p/ pV P                   P                  4        FD  w  r4VP                  P                  R 4      '       d   WBV&   V P	                  VV4      W&   K@  W1V&   KF  	  W3# )r2   )r   ra   r   r   _find_concrete_model_from_proxy)rK   r
  proxy_modelsr[   rZ   s   &    r#   r  :ProjectState._get_concrete_models_mapping_and_proxy_models!  sy    "$&*kk&7&7&9"I""&&w//*5Y' 88$# (2 6?	2 ': '44r%   c                   VP                    Ft  p\        V\        4      '       g#   \        V\        P
                  4      '       g   K;  \        V4      pVP                  V4      pV'       g   Vu # V P                  W4      u # 	  R # rO   )	basesr   r   r*   r   r+   r   r   r  )rK   r  rZ   basebase_key
base_states   &&&   r#   r  ,ProjectState._find_concrete_model_from_proxy3  se    %%DtS))Zfll-K-K'-H%))(3J77QQ &r%   c           	     6   \        V P                  P                  4        UUu/ uF  w  rWP                  4       bK  	  uppV P                  R7      pRV P
                  9   d    V P                  P                  4       Vn        V P                  Vn        V# u uppi )z*Return an exact copy of this ProjectState.r   rH   r   )rF   r   ra   rl   rH   rX   r   rI   )rK   kv	new_states   &   r#   rl   ProjectState.clone>  sv     -1[[->->-@A-@TQAwwyL-@Ann
	 T]]"!YY__.IN#	 Bs   B
c                n    V P                   '       d#   R V P                  9   d   V P                  R  R# R# R# r   )rI   rX   rQ   s   &r#   clear_delayed_apps_cache%ProjectState.clear_delayed_apps_cacheI  s)    ???v6f%  7?r%   c                B    \        V P                  V P                  4      # rO   )	StateAppsrH   r   rQ   s   &r#   r   ProjectState.appsM  s    55r%   c                    / pVP                  RR7       F2  p\        P                  V4      pWBVP                  VP                  3&   K4  	  V ! V4      # )z3Take an Apps and return a ProjectState matching it.T)include_swapped)
get_models
ModelState
from_modelr    rV   )clsr   
app_modelsr"   rZ   s   &&   r#   	from_appsProjectState.from_appsQ  sS     
__T_:E$//6KJU--{/E/EFG ; :r%   c                v    V P                   VP                   8H  ;'       d    V P                  VP                  8H  # rO   r  rK   others   &&r#   __eq__ProjectState.__eq__Z  s*    {{ell*PPt~~/PPr%   )rJ   rI   r   rH   )NNrO   Fr   )/__name__
__module____qualname____firstlineno____doc__rL   propertyrR   r\   rf   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rY   rs   r   r   r   rW   rP   r  r  r  rl   r  r   r   classmethodr*  r/  __static_attributes____classdictcell____classdict__s   @r#   rF   rF   _   s    
  
*$ %AN===
=
==EJ=NS

3334@3D0d)
)949.
8XO 25$	R	& 6 6  Q Qr%   rF   c                   0   a  ] tR tRt o RtR tR tRtV tR# )AppConfigStubi^  zAStub of an AppConfig. Only provides a label and a dict of models.c                :    R V n         / V n        Wn        Wn        R # rO   )r   r   labelrm   )rK   r@  s   &&r#   rL   AppConfigStub.__init__a  s    	 
	r%   c                ^    V P                   P                  V P                  ,          V n        R # rO   )r   
all_modelsr@  r   rQ   s   &r#   import_modelsAppConfigStub.import_modelsj  s    ii**4::6r%   )r   r@  r   rm   N)	r2  r3  r4  r5  r6  rL   rD  r9  r:  r;  s   @r#   r>  r>  ^  s     K7 7r%   r>  c                   b   a a ] tR tRt oRtR
V 3R llt]R 4       tR tR t	R t
R tR	tVtV ;t# )r!  in  zc
Subclass of the global Apps registry class to better handle dynamic model
additions and removals.
c           	       < . V n         V F`  p\        P                  ! V4      pVP                  4        F3  pV P                   P	                  \
        P                  VR R7      4       K5  	  Kb  	  VP                  ! 4        Uu0 uF  qwP                  kK  	  pp\        . VOVO4       U	u. uF  p	\        V	4      NK  	  p
p	\        SV `1  V
4       RV n        RV n        V P                  . VP                  ! 4       OV P                   O4       ^ RIHp V'       d   \%        \&        P(                  4      0M	\+        4       pV! WR7      pV'       d"   \-        RP/                  R V 4       4      4      hR# u upi u up	i )T)exclude_relsN)_check_lazy_references)ignore
c              3   8   "   T F  qP                   x  K  	  R # 5irO   )msg).0errors   & r#   	<genexpr>%StateApps.__init__.<locals>.<genexpr>  s     &EfUyyfs   )r   global_appsget_app_configr%  r1   r&  r'  rr   r    sortedr>  superrL   _lockready_eventr   django.core.checks.model_checksrI  r   r	   AUTH_USER_MODELr,   
ValueErrorjoin)rK   rH   r   ignore_swappabler    appr"   rZ   
app_labelsr@  app_configsrI  rJ  errors	__class__s   &&&&          r#   rL   StateApps.__init__t  sW    "I,,Y7C)  ''
(=(=eRV(=(WX * #
 @F}}O++
O.45Ny5N:5N.O
.OUM% .O 	 
 	%
 
Bv}}B1A1ABC 	K =Mh6678RURW 	 (<TYY&Ef&EEFF + P
s   E0)E5c              #     "   V P                   pR V n          Rx  Wn         V P                  4        R#   Yn         T P                  4        i ; i5i)FN)readyrc   )rK   rd  s   & r#   r   StateApps.bulk_update  sD      


	J Js   A3 AAAc           	        V'       g   R # V P                  4       ;_uu_ 4        TpV'       dW   . pV F  p VP                  V 4       K  	  \	        V4      \	        V4      8X  d   \        RV: R\        4       : R24      hTpK^   R R R 4       R #   \         d    TP                  T4        K|  i ; i  + '       g   i     R # ; i)NzCannot resolve bases for z
This can happen if you are inheriting models from an app with migrations (e.g. contrib.auth)
 in an app with no migrations; see https://docs.djangoproject.com/en/z)/topics/migrations/#dependencies for more)r   renderr   r1   r   r   )rK   model_statesunrendered_modelsnew_unrendered_modelsr"   s   &&   r#   r   StateApps.render_multiple  s    
  ,#(*%.E<T* /
 ,-5F1GG+ 12B2DF  %:!! $   - <-44U;<  s3   
B2B2B=B2B/	+B2.B/	/B22C	c                   \        . / 4      p\        P                  ! V P                  4      Vn        V P                   F2  p\        V4      pWn        VP                  4        W1P                  V&   K4  	  V P                  Vn        V# )z Return a clone of this registry.)	r!  copydeepcopyrC  r_  r>  r   rD  r   )rK   rl   r    
app_configs   &   r#   rl   StateApps.clone  sq    "b!==9))I&y1J#O$$&+5i(	 * !,,r%   c                ~   W P                   V,          VP                  P                  &   WP                  9  d0   \	        V4      V P                  V&   W P                  V,          n        W P                  V,          P                  VP                  P                  &   V P                  V4       V P                  4        R # rO   )	rC  r   r!   r_  r>  r   r   do_pending_operationsrc   )rK   r    r"   s   &&&r#   register_modelStateApps.register_model  s    =B	"5;;#9#9:,,,*7	*BDY'/3Y',EJ#**5;;+A+AB""5)r%   c                     V P                   V,          V V P                  V,          P                  V R #   \         d     R # i ; irO   )rC  r_  r   r   )rK   r    r!   s   &&&r#   rb   StateApps.unregister_model  sC    		*:6  +22:> 		s   26 AA)rV  rd  rW  r   r1  )r2  r3  r4  r5  r6  rL   r   r   r   rl   rs  rb   r9  r:  __classcell__)ra  r<  s   @@r#   r!  r!  n  s>     
"GH 	 	:8 r%   r!  c                      a  ] tR tRt o RtRR lt]R 4       tR t]	RR l4       t
R tR	 tR
 tR tR tR tR tRtV tR# )r&  i  a  
Represent a Django Model. Don't use the actual Model class as it's not
designed to have its options changed - instead, mutate this one and then
render it into a Model as required.

Note that while you are allowed to mutate .fields, you are not allowed
to mutate the Field instances inside there themselves - you must instead
assign new ones, as these are not detached during a clone.
Nc           
        Wn         W n        \        V4      V n        T;'       g    / V n        V P                  P                  R . 4       V P                  P                  R. 4       T;'       g    \        P                  3V n        T;'       g    . V n	        V P                  P                  4        F  w  r'\        VR4      '       d   \        RV,          4      hVP                  '       dF   \        VP                  R4      '       d*   \        RV P                    RV P                   RV R24      hVP                  '       g   K  \        VP                   P"                  R4      '       g   K  \        RV P                    RV P                   RV R24      h	  V P                  R ,           F'  pVP                  '       d   K  \        R	V,          4      h	  R
# )r   r   r"   z7ModelState.fields cannot be bound to a model - "%s" is.r   zEModel fields in "ModelState.fields" cannot refer to a model class - "r   z*.to" does. Use a string reference instead.z/.through" does. Use a string reference instead.zKIndexes passed to ModelState require a name attribute. %r doesn't have one.N)r    rm   r  rq   r   
setdefaultr   r+   r  r   ra   hasattrrZ  r.   r/   many_to_manyro   rp   )	rK   r    rm   rq   r   r  r   r|   r   s	   &&&&&&&  r#   rL   ModelState.__init__  s    #	6l}}"	2.r2--v||o
 B;;,,.KDug&& MPTT     WU-@-@'%J%J ..)499+Qtf =)) 
 !!!ge.@.@.H.H'&R&R ..)499+Qtf =00  /( \\),,E::: +-23  -r%   c                6    V P                   P                  4       # rO   )rm   rk   rQ   s   &r#   rV   ModelState.name_lower  s    yy  r%   c                    VR 8X  d1   V P                   P                  R4      e   V P                   R,          pV P                  V,          # )_orderorder_with_respect_to)r   r   rq   )rK   r   s   &&r#   	get_fieldModelState.get_field  s>    ("  !89E&=>J{{:&&r%   c           
     

  aa . pSP                   P                   Fo  p\        VRR4      '       d   V'       d   K   \        V\        P
                  4      '       d   KB  VP                  p VP                  WTP                  4       34       Kq  	  V'       gK   SP                   P                   F0  pVP                  p VP                  WTP                  4       34       K2  	  / p\         EF2  pVR9   d   K  VSP                   P                  9   g   K*  VR8X  d6   SP                   P                  R,          p\        \!        V4      4      Wu&   Kf  VR8X  dg   SP                   P"                   U	u. uF  qP                  4       NK  	  p
p	V
 F(  pVP                  '       d   K  VP%                  S4       K*  	  WR&   K  VR	8X  d:   SP                   P&                   Uu. uF  qP                  4       NK  	  upVR	&   EK  SP                   P                  V,          Wu&   EK5  	  V'       d   R F  pW9   g   K  W} K  	  MFVP)                  R
4      SP                   P*                   Uu0 uF  qDP                  kK  	  up9   d   VR
 V3R lo\-        \        S! S4      4      V3R lR7      p\.        ;QJ d    . R V 4       F  NK  	  5M! R V 4       4      p\0        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       g   \        P2                  3p. p\        4       pRpSP                   P4                   F  pVP                  V9   d   K  VP6                  '       d(   \8        P8                  ! V4      pVP;                  4        MlVSP<                  J g   VSP>                  J dK   \        P@                  ! 4       pVPB                  Vn!        VP                  Vn        VSP>                  J d   TpMK  VPE                  VP                  4       VP                  VP                  V34       K  	  VRV3.8X  d   . pV ! SP                   PF                  SP                   P                  VVVV4      #   \         d1   p\        RT: RSP                   P                  : RT: 24      hRp?ii ; i  \         d1   p\        RT: RSP                   P                  : RT: 24      hRp?ii ; iu up	i u upi u upi )z3Given a model, return a ModelState representing it.ro   NzCouldn't reconstruct field z on z: zCouldn't reconstruct m2m field r   r   r   r  c                    < . pV P                    F[  p\        VR 4      '       d6   VP                  P                  '       d   VP	                  S! V4      4       KJ  VP                  V4       K]  	  V# )r   )	__bases__r{  r   abstractr?   r1   )r"   r  r  flatten_basess   &  r#   r  ,ModelState.from_model.<locals>.flatten_basesc  sV    E4))djj.A.A.ALLt!45LL&	 (
 Lr%   c                 :   < SP                   P                  V 4      # rO   )__mro__r   )xr"   s   &r#   <lambda>'ModelState.from_model.<locals>.<lambda>r  s    U]]5H5H5Kr%   r   c              3   v   "   T F/  p\        VR 4      '       d   VP                  P                  MTx  K1  	  R# 5i)r   N)r{  r   label_lowerrN  r  s   & r#   rP  (ModelState.from_model.<locals>.<genexpr>v  s2      
' (/tW'='=TZZ##4G's   79c              3      "   T F7  p\        V\        4      ;'       g    \        V\        P                  4      x  K9  	  R # 5irO   )r   r   r*   r   r+   r  s   & r#   rP  r  {  s1      
RW$Zc"DDjv||&DDRWs
   A#ATFobjects)r   r    )r   r  )$r   local_fieldsr   r   r   OrderWrtrm   r1   rl   	TypeErrorr@  local_many_to_manyobject_namer   original_attrsr,   r   r   set_name_with_modelr   r   private_fieldsrT  r   anyr+   r   use_in_migrationsrm  _set_creation_counter_base_manager_default_managerManagerr"   r0   r    )r(  r"   rH  rq   r|   rm   er   utidxr   r   conr   flattened_basesr  r   manager_namesdefault_manager_shimmanagernew_managerr  s   &f&                  @r#   r'  ModelState.from_model  s9    [[--Eund33%11::D
t[[]34 ." 77zz
MM4"78 8 !MD,,333,,334EFB$'(:2(>$?GMY&6;kk6I6IJ6Isyy{6IGJ!($zzz!55e< ") *1I&]*/4{{/F/F./F		/F.GM* %*KK$>$>t$DGM' ", C> D [[01$)KK$>$>6
$>5JJ$>6
 
 /0	 !e$%+K

  
'
 
'
 

 s 
RW
sss 
RW
 
 
 \\OE#{{++G||},***"ii0113E///7e>T>T3T$nn.$+MM!#*<< e444+6(gll+OOW\\;78% ,* $89::H KK!!KK##
 	
e   ))	  ! # !!KK33	 ( K.6
sB   * Q:< R8-S6S;#T :R5+R00R58S3+S..S3c              #     "   \        V P                  R R7      pV FW  w  r#VP                  4       w  rErgpV'       d!   \        V4      p	W)P	                  4       3x  KA  \        V4      p
W*! V/ VB 3x  KY  	  R# 5i)z-Deep-clone the managers using deconstruction.c                 (    V ^,          P                   # )   )creation_counter)r  s   &r#   r  /ModelState.construct_managers.<locals>.<lambda>  s    ad>S>Sr%   r  N)rT  r   deconstructr   
as_manager)rK   sorted_managersmgr_namer  r  manager_pathqs_pathargskwargsqs_classmanager_classs   &          r#   construct_managersModelState.construct_managers  sx      !4ST!0H>E>Q>Q>S;JgV(1 3 3 555 -l ;t >v >>> "1s   A8A:c           
         V P                  V P                  V P                  \        V P                  4      \        V P
                  4      V P                  \        V P                  4      R7      # )z(Return an exact copy of this ModelState.)r    rm   rq   r   r  r   )	ra  r    rm   r  rq   r   r  r`   r   rQ   s   &r#   rl   ModelState.clone  sS    ~~nn$ &**$--(  

 
	
r%   c                ^  a / V P                   CpVP                  RR4       RV P                  RS/VCp\        RR
V4      p \        ;QJ d!    . V3R lV P
                   4       F  NK  	  5M! V3R lV P
                   4       4      pT P                  P                  4        UUu/ uF  w  rgYgP                  4       bK  	  pppYHR&   RTR	&   TP                  T P                  4       4       \        T P                  YX4      #   \         d    \        RT P
                  : 24      hi ; iu uppi )zACreate a Model object from our current state into the given apps.r   Nr    r   Metac              3      <"   T FE  pV\         P                  8w  g   K  \        V\        4      '       d   SP	                  V4      MTx  KG  	  R # 5irO   )typingGenericr   r   r   )rN  r  r   s   & r#   rP  $ModelState.render.<locals>.<genexpr>  sA      &D6>>) ID#)>)>%DH&s
   A1Az&Cannot resolve one or more bases from __fake__r3   )r   r_   r    typer   r  r   r   rq   ra   rl   r   r  rm   )	rK   r   meta_optionsmeta_contentsmetar  rm   r|   bodys	   &f       r#   rg  ModelState.render  s    ($,,' 	)40$dnnfdSlSFB.		E  JJEE  JJ E 8<{{7H7H7JK7Jkkm#7JKV'\ 	D++-.DIIu++  	#>BjjJ 	
 Ls   
D ;D %D)%D&c                    V P                   R ,           F  pVP                  V8X  g   K  Vu # 	  \        RV: RV P                  : 24      h)r   zNo index named 
 on model r   rm   rZ  )rK   rm   r   s   && r#   get_index_by_nameModelState.get_index_by_name  s?    \\),,EzzT! - D$))LMMr%   c                    V P                   R ,           F  pVP                  V8X  g   K  Vu # 	  \        RV: RV P                  : 24      h)r   zNo constraint named r  r  )rK   rm   r   s   && r#   get_constraint_by_name!ModelState.get_constraint_by_name  s@    ,,}55J$&!! 6 tyyQRRr%   c                p    R V P                   P                  : RV P                  : RV P                  : R2# )<z: 'r   z'>)ra  r2  r    rm   rQ   s   &r#   __repr__ModelState.__repr__  s!    "&.."9"94>>499UUr%   c           
     P   V P                   VP                   8H  ;'       Ed    V P                  VP                  8H  ;'       Edd    \        V P                  4      \        VP                  4      8H  ;'       Ed0    \        ;QJ dh    R  \        \        V P                  P                  4       4      \        VP                  P                  4       4      4       4       F  '       d   K   RM]	  RMY! R  \        \        V P                  P                  4       4      \        VP                  P                  4       4      4       4       4      ;'       d\    V P                  VP                  8H  ;'       d;    V P                  VP                  8H  ;'       d    V P                  VP                  8H  # )c              3      "   T FG  w  w  rw  r4W8H  ;'       d0    VP                  4       R ,          VP                  4       R ,          8H  x  KI  	  R# 5i):r  NNN)r  )rN  k1f1k2f2s   &    r#   rP  $ModelState.__eq__.<locals>.<genexpr>  sN      +&HRhr IIR^^-b1R^^5Eb5III+s   AAFT)r    rm   r   rq   allziprT  ra   r   r  r   r-  s   &&r#   r/  ModelState.__eq__  s=   ^^u. 2 2ejj(2 2T[[!S%662 2  *-4;;,,./5<<--/0+ *-4;;,,./5<<--/0+ 2 2 .2 2 u{{*2 2 %..0	
r%   )r    r  rq   r   rm   r   )NNNr1  )r2  r3  r4  r5  r6  rL   r   rV   r  r8  r'  r  rl   rg  r  r  r  r/  r9  r:  r;  s   @r#   r&  r&    sk     $L ! !' E
 E
N?
,<NSV
 
r%   r&  ) )2rm  r  collectionsr   
contextlibr   	functoolsr   django.appsr   django.apps.registryr   r   rR  django.confr	   django.core.exceptionsr
   	django.dbr   django.db.migrations.utilsr   r   django.db.modelsr   django.db.models.fields.relatedr   django.db.models.optionsr   r   django.db.models.utilsr   django.utils.functionalr   django.utils.module_loadingr   django.utils.versionr   
exceptionsr   utilsr   r$   r:   r=   rD   rF   r>  r!  r&  r  r%   r#   <module>r     s      # %  ! % 4   4  J ) K F 3 3 5 1 ) #=0D4|Q |Q~7I 7 o od\
 \
r%   