
    (ph1                         S SK Jr  S SKJr  S SKJr  SSKJr   " S S\5      r " S S	\5      r	 " S
 S\5      r
 " S S\5      r " S S\5      rg)    )field_references)NOT_PROVIDED)cached_property   )	Operationc                   j   ^  \ rS rSrSS jr\S 5       r\S 5       rS rS r	S r
S rU 4S	 jrS
rU =r$ )FieldOperation   c                 (    Xl         X l        X0l        g N
model_namenamefield)selfr   r   r   s       Y/var/www/html/venv/lib/python3.13/site-packages/django/db/migrations/operations/fields.py__init__FieldOperation.__init__	   s    $	
    c                 6    U R                   R                  5       $ r   )r   lowerr   s    r   model_name_lowerFieldOperation.model_name_lower   s    $$&&r   c                 6    U R                   R                  5       $ r   )r   r   r   s    r   
name_lowerFieldOperation.name_lower   s    yy  r   c                 4    U R                   UR                   :H  $ r   )r   r   	operations     r   is_same_model_operation&FieldOperation.is_same_model_operation   s    $$	(B(BBBr   c                 d    U R                  U5      =(       a    U R                  UR                  :H  $ r   )r!   r   r   s     r   is_same_field_operation&FieldOperation.is_same_field_operation   s,    ((3 89#7#77	
r   c                     UR                  5       nX0R                  :X  a  gU R                  (       a,  [        [	        X R                  4U R                  X#45      5      $ g)NTF)r   r   r   boolr   )r   r   	app_labelr   s       r   references_modelFieldOperation.references_model   sV    ZZ\
...::  5 56JJ+  r   c                 b   UR                  5       nX@R                  :X  aV  X R                  :X  a  gU R                  (       a5  [	        U R                  S5      (       a  X R                  R
                  ;   a  gU R                  c  g[        [        X0R                  4U R                  X44U5      5      $ )NTfrom_fieldsF)r   r   r   r   hasattrr,   r'   r   )r   r   r   r(   r   s        r   references_fieldFieldOperation.references_field-   s    %++-444yy 

DJJ66JJ222::112

-	
 	
r   c                    > [         TU ]  X5      =(       d,    UR                  U R                  U R                  U5      (       + $ r   )superreducer.   r   r   r   r    r(   	__class__s      r   r2   FieldOperation.reduceE   s:    w~i3 
9;U;UOOTYY	<
 8
 	
r   )r   r   r   r   )__name__
__module____qualname____firstlineno__r   r   r   r   r!   r$   r)   r.   r2   __static_attributes____classcell__r4   s   @r   r	   r	      sO    
 ' ' ! !C

0
 
r   r	   c                   j   ^  \ rS rSrSrSU 4S jjrS rS rS rS r	S r
\S	 5       rU 4S
 jrSrU =r$ )AddFieldK   zAdd a field to a model.c                 2   > X@l         [        TU ]	  XU5        g r   preserve_defaultr1   r   r   r   r   r   rB   r4   s        r   r   AddField.__init__N        051r   c                     U R                   U R                  U R                  S.nU R                  SLa  U R                  US'   U R                  R
                  / U4$ Nr   TrB   r   r   r   rB   r4   r6   r   kwargss     r   deconstructAddField.deconstructR   V    //IIZZ

   ,)-)>)>F%&''V44r   c                 ~    UR                  UU R                  U R                  U R                  U R                  5        g r   )	add_fieldr   r   r   rB   r   r(   states      r   state_forwardsAddField.state_forwards\   s1    !!IIJJ!!	
r   c                    UR                   R                  XR                  5      nU R                  UR                  R
                  U5      (       a  UR                   R                  XR                  5      nUR                  R                  U R                  5      nU R                  (       d  U R                  R                  Ul        UR                  UU5        U R                  (       d  [        Ul        g g g r   )apps	get_modelr   allow_migrate_model
connectionalias_meta	get_fieldr   rB   r   defaultrO   r   )r   r(   schema_editor
from_stateto_stateto_model
from_modelr   s           r   database_forwardsAddField.database_forwardse   s    ==**9ooF##M$<$<$B$BHMM#229ooNJNN,,TYY7E(( $

 2 2## (( , ) Nr   c                    UR                   R                  XR                  5      nU R                  UR                  R
                  U5      (       a5  UR                  XUR                  R                  U R                  5      5        g g r   
rU   rV   r   rW   rX   rY   remove_fieldrZ   r[   r   r   r(   r]   r^   r_   ra   s         r   database_backwardsAddField.database_backwardss   e    __..y//J
##M$<$<$B$BJOO&&,,66tyyA Pr   c                 >    SU R                   < SU R                  < 3$ )Nz
Add field  to r   r   r   s    r   describeAddField.describez   s    '+yy$//BBr   c                 <    U R                   < SU R                  < 3$ )N_r   r   r   s    r   migration_name_fragment AddField.migration_name_fragment}   s    //AAr   c                   > [        U[        5      (       a  U R                  U5      (       a  [        U[        5      (       a*  [	        U R
                  UR                  UR                  S9/$ [        U[        5      (       a  / $ [        U[        5      (       a*  [	        U R
                  UR                  U R                  S9/$ [        TU ]1  X5      $ Nr   )
isinstancer	   r$   
AlterFieldr>   r   r   r   RemoveFieldRenameFieldnew_namer1   r2   r3   s      r   r2   AddField.reduce   s    i00T5Q5Q6
 6
 )Z00#'??&^^'oo  I{33	I{33#'??&//"jj  w~i33r   rB   Tr6   r7   r8   r9   __doc__r   rK   rR   rb   rh   rn   propertyrs   r2   r:   r;   r<   s   @r   r>   r>   K   sE    !25
-C B B4 4r   r>   c                   Z   ^  \ rS rSrSrS rS rS rS rS r	\
S 5       rU 4S	 jrS
rU =r$ )ry      zRemove a field from a model.c                 f    U R                   U R                  S.nU R                  R                  / U4$ )N)r   r   )r   r   r4   r6   rI   s     r   rK   RemoveField.deconstruct   s0    //II
 ''V44r   c                 P    UR                  XR                  U R                  5        g r   )rf   r   r   rP   s      r   rR   RemoveField.state_forwards   s    9&;&;TYYGr   c                    UR                   R                  XR                  5      nU R                  UR                  R
                  U5      (       a5  UR                  XUR                  R                  U R                  5      5        g g r   re   rg   s         r   rb   RemoveField.database_forwards   rj   r   c                 X   UR                   R                  XR                  5      nU R                  UR                  R
                  U5      (       aZ  UR                   R                  XR                  5      nUR                  XeR                  R                  U R                  5      5        g g r   )
rU   rV   r   rW   rX   rY   rO   rZ   r[   r   r   r(   r]   r^   r_   r`   ra   s          r   rh   RemoveField.database_backwards   sx    ==**9ooF##M$<$<$B$BHMM#229ooNJ##J0H0H0ST Nr   c                 >    SU R                   < SU R                  < 3$ )NzRemove field z from rm   r   s    r   rn   RemoveField.describe   s    ,0IItGGr   c                 >    SU R                   < SU R                  < 3$ )Nremove_rq   rr   r   s    r   rs   #RemoveField.migration_name_fragment   s    !%!6!6HHr   c                    > SSK Jn  [        X5      (       a  UR                  U R                  :X  a  U/$ [
        TU ]  X5      $ )Nr   )DeleteModel)modelsr   rw   r   r   r1   r2   )r   r    r(   r   r4   s       r   r2   RemoveField.reduce   s>    ' y..$$(=(==;w~i33r    )r6   r7   r8   r9   r   rK   rR   rb   rh   rn   r   rs   r2   r:   r;   r<   s   @r   ry   ry      sB    &5HUH I I4 4r   ry   c                   j   ^  \ rS rSrSrSU 4S jjrS rS rS rS r	S r
\S	 5       rU 4S
 jrSrU =r$ )rx      zT
Alter a field's database column (e.g. null, max_length) to the provided
new field.
c                 2   > X@l         [        TU ]	  XU5        g r   rA   rC   s        r   r   AlterField.__init__   rE   r   c                     U R                   U R                  U R                  S.nU R                  SLa  U R                  US'   U R                  R
                  / U4$ rG   rH   rI   s     r   rK   AlterField.deconstruct   rM   r   c                 ~    UR                  UU R                  U R                  U R                  U R                  5        g r   )alter_fieldr   r   r   rB   rP   s      r   rR   AlterField.state_forwards   s3    !!IIJJ!!	
r   c                 :   UR                   R                  XR                  5      nU R                  UR                  R
                  U5      (       a  UR                   R                  XR                  5      nUR                  R                  U R                  5      nUR                  R                  U R                  5      nU R                  (       d  U R                  R                  Ul        UR                  XgU5        U R                  (       d  [        Ul        g g g r   )rU   rV   r   rW   rX   rY   rZ   r[   r   rB   r   r\   r   r   )	r   r(   r]   r^   r_   r`   ra   
from_fieldto_fields	            r   rb   AlterField.database_forwards   s    ==**9ooF##M$<$<$B$BHMM#229ooNJ#))33DII>J~~//		:H((#'::#5#5 %%jhG((#/  ) Nr   c                 (    U R                  XX45        g r   )rb   )r   r(   r]   r^   r_   s        r   rh   AlterField.database_backwards   s    yNr   c                 >    SU R                   < SU R                  < 3$ )NzAlter field  on rm   r   s    r   rn   AlterField.describe   s    )-DOODDr   c                 >    SU R                   < SU R                  < 3$ )Nalter_rq   rr   r   s    r   rs   "AlterField.migration_name_fragment   s     $ 5 5tGGr   c                 d  > [        U[        [        45      (       a  U R                  U5      (       a  U/$ [        U[        5      (       aX  U R                  U5      (       aB  U R
                  R                  c+  U[        U R                  UR                  U R
                  S9/$ [        TU ])  X5      $ rv   )rw   rx   ry   r$   rz   r   	db_columnr   r{   r1   r2   r3   s      r   r2   AlterField.reduce   s    
K0
 
**955;y+..,,Y77

$$, #"++**  w~i33r   r}   r~   r   r<   s   @r   rx   rx      sH    
25

0OE H H4 4r   rx   c                      ^  \ rS rSrSrU 4S jr\S 5       r\S 5       rS r	S r
S rS	 rS
 r\S 5       rS rU 4S jrSrU =r$ )rz   i  z8Rename a field on the model. Might affect db_column too.c                 <   > X l         X0l        [        TU ]  X5        g r   )old_namer{   r1   r   )r   r   r   r{   r4   s       r   r   RenameField.__init__  s      .r   c                 6    U R                   R                  5       $ r   )r   r   r   s    r   old_name_lowerRenameField.old_name_lower      }}""$$r   c                 6    U R                   R                  5       $ r   )r{   r   r   s    r   new_name_lowerRenameField.new_name_lower  r   r   c                 |    U R                   U R                  U R                  S.nU R                  R                  / U4$ )N)r   r   r{   )r   r   r{   r4   r6   rI   s     r   rK   RenameField.deconstruct  s7    //

 ''V44r   c                 f    UR                  XR                  U R                  U R                  5        g r   )rename_fieldr   r   r{   rP   s      r   rR   RenameField.state_forwards&  s%    ,,dmmT]]	
r   c                    UR                   R                  XR                  5      nU R                  UR                  R
                  U5      (       a  UR                   R                  XR                  5      nUR                  UUR                  R                  U R                  5      UR                  R                  U R                  5      5        g g r   )rU   rV   r   rW   rX   rY   r   rZ   r[   r   r{   r   s          r   rb   RenameField.database_forwards+      ==**9ooF##M$<$<$B$BHMM#229ooNJ%%  **4==9((7 Nr   c                    UR                   R                  XR                  5      nU R                  UR                  R
                  U5      (       a  UR                   R                  XR                  5      nUR                  UUR                  R                  U R                  5      UR                  R                  U R                  5      5        g g r   )rU   rV   r   rW   rX   rY   r   rZ   r[   r{   r   r   s          r   rh   RenameField.database_backwards5  r   r   c                 Z    SU R                   < SU R                  < SU R                  < 3$ )NzRename field r   rl   )r   r   r{   r   s    r   rn   RenameField.describe?  s!    MMOOMM
 	
r   c                 Z    SU R                   < SU R                  < SU R                  < 3$ )Nrename_rq   )r   r   r   r   s    r   rs   #RenameField.migration_name_fragmentF  s)     !!
 	
r   c                     U R                  X5      =(       aA    UR                  5       U R                  :H  =(       d    UR                  5       U R                  :H  $ r   )r)   r   r   r   )r   r   r   r(   s       r   r.   RenameField.references_fieldN  sD    $$Z; 
JJLD///V4::<4CVCV3V	
r   c                   > [        U[        5      (       a\  U R                  U5      (       aF  U R                  UR                  :X  a,  [        U R
                  U R                  UR                  5      /$ [        [        U ]+  X5      =(       dZ    UR                  U R
                  U R                  U5      =(       d'    UR                  U R
                  U R                  U5      (       + $ r   )rw   rz   r!   r   r   r   r   r{   r1   r	   r2   r.   r3   s      r   r2   RenameField.reduceS  s    y+..,,Y77##y'?'?? OOMM&&  ^T1)G 
&&tyQ U))$//4==)TL
 	
r   )r{   r   )r6   r7   r8   r9   r   r   r   r   r   rK   rR   rb   rh   rn   r   rs   r.   r2   r:   r;   r<   s   @r   rz   rz     so    B/
 % % % %5


 
 



 
r   rz   N)django.db.migrations.utilsr   django.db.modelsr   django.utils.functionalr   baser   r	   r>   ry   rx   rz   r   r   r   <module>r      sY    7 ) 3 @
Y @
FL4~ L4^)4. )4XE4 E4PW
. W
r   