§
    ¤”j4  ã                   óÀ   — d dl Z d dlZd dl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
¦  «        Z G d„ de¦  «        Z G d„ de¦  «        ZdS )é    N)Úapps)ÚOutputWrapper)ÚNOT_PROVIDED)Útimezone)Úget_docs_versioné   )ÚMigrationLoaderc                   óJ   — e Zd ZdZdd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
d
„ Zd„ ZdS )ÚMigrationQuestionerzË
    Give the autodetector responses to questions it might have.
    This base class has a built-in noninteractive mode, but the
    interactive subclass is what the command-line arguments will use.
    Nc                 óP   — |pi | _         |pt          ¦   «         | _        || _        d S ©N)ÚdefaultsÚsetÚspecified_appsÚdry_run)Úselfr   r   r   s       ún/var/www/finuniver-perm.ru/html/portfolio/venv/lib/python3.11/site-packages/django/db/migrations/questioner.pyÚ__init__zMigrationQuestioner.__init__   s)   € Ø ˜ BˆŒØ,Ð5µ±´ˆÔØˆŒˆˆó    c                 óü  — || j         v rdS 	 t          j        |¦  «        }n+# t          $ r | j                             dd¦  «        cY S w xY wt          j        |j        ¦  «        \  }}|€| j                             dd¦  «        S 	 t          j
        |¦  «        }t          |dd¦  «        r7t          j        t          j                             |j        ¦  «        ¦  «        }nVt#          |d¦  «        rFt%          |j        ¦  «        dk    rdS t          j        t)          |j        ¦  «        d         ¦  «        }t+          d	„ |D ¦   «         ¦  «         S # t,          $ r | j                             dd¦  «        cY S w xY w)
z2Should we create an initial migration for the app?TÚask_initialFNÚ__file__Ú__path__r   r   c              3   óL   K  — | ]}|d k    ¯|                      d¦  «        V — Œ dS )z__init__.pyz.pyN)Úendswith)Ú.0Úxs     r   ú	<genexpr>z2MigrationQuestioner.ask_initial.<locals>.<genexpr>7   s8   è è € ÐVÐV°À1ÈÒCUÐCU˜1Ÿ:š: eÑ,Ô,ÐCUÐCUÐCUÐCUÐVÐVr   )r   r   Úget_app_configÚLookupErrorr   Úgetr	   Úmigrations_moduleÚlabelÚ	importlibÚimport_moduleÚgetattrÚosÚlistdirÚpathÚdirnamer   ÚhasattrÚlenr   ÚlistÚanyÚImportError)r   Ú	app_labelÚ
app_configÚmigrations_import_pathÚ_r"   Ú	filenamess          r   r   zMigrationQuestioner.ask_initial   sœ  € ð ˜Ô+Ð+Ð+Ø�4ð
	;ÝÔ,¨YÑ7Ô7ˆJˆJøÝð 	;ð 	;ð 	;Ø”=×$Ò$ ]°EÑ:Ô:Ð:Ð:Ð:ð	;øøøå$3Ô$EÀjÔFVÑ$WÔ$WÑ!Ð Ø!Ð)à”=×$Ò$ ]°EÑ:Ô:Ð:ð	WÝ )Ô 7Ð8NÑ OÔ OÐõ Ð(¨*°dÑ;Ô;ð LÝœJ¥r¤w§¢Ð7HÔ7QÑ'RÔ'RÑSÔS�	�	ÝÐ*¨JÑ7Ô7ð LÝÐ(Ô1Ñ2Ô2°QÒ6Ð6Ø ˜5ÝœJ¥tÐ,=Ô,FÑ'GÔ'GÈÔ'JÑKÔK�	ÝÐVÐV°iÐVÑVÔVÑVÔVÐVÐVøõ ð 	;ð 	;ð 	;Ø”=×$Ò$ ]°EÑ:Ô:Ð:Ð:Ð:ð	;øøøs!   �" ¢%A
Á	A
ÂE Å%E;Å:E;c                 ó   — dS )ú#Adding a NOT NULL field to a model.N© ©r   Ú
field_nameÚ
model_names      r   Úask_not_null_additionz)MigrationQuestioner.ask_not_null_addition9   ó	   € ð ˆtr   c                 ó   — dS )ú"Changing a NULL field to NOT NULL.Nr7   r8   s      r   Úask_not_null_alterationz+MigrationQuestioner.ask_not_null_alteration>   r<   r   c                 ó8   — | j                              dd¦  «        S )úWas this field really renamed?Ú
ask_renameF©r   r!   )r   r:   Úold_nameÚnew_nameÚfield_instances        r   rB   zMigrationQuestioner.ask_renameC   s   € àŒ}× Ò  ¨uÑ5Ô5Ð5r   c                 ó8   — | j                              dd¦  «        S )úWas this model really renamed?Úask_rename_modelFrC   )r   Úold_model_stateÚnew_model_states      r   rI   z$MigrationQuestioner.ask_rename_modelG   s   € àŒ}× Ò Ð!3°UÑ;Ô;Ð;r   c                 ó8   — | j                              dd¦  «        S )z)Should these migrations really be merged?Ú	ask_mergeFrC   ©r   r0   s     r   rM   zMigrationQuestioner.ask_mergeK   s   € àŒ}× Ò  ¨eÑ4Ô4Ð4r   c                 ó   — dS )ú(Adding an auto_now_add field to a model.Nr7   r8   s      r   Úask_auto_now_add_additionz-MigrationQuestioner.ask_auto_now_add_additionO   r<   r   c                 ó   — dS )ú.Adding a unique field with a callable default.Nr7   r8   s      r   Ú$ask_unique_callable_default_additionz8MigrationQuestioner.ask_unique_callable_default_additionT   r<   r   )NNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r;   r?   rB   rI   rM   rQ   rT   r7   r   r   r   r      s­   € € € € € ðð ðð ð ð ð
Wð Wð Wð<ð ð ð
ð ð ð
6ð 6ð 6ð<ð <ð <ð5ð 5ð 5ðð ð ð
ð ð ð ð r   r   c                   ób   ‡ — e Zd Z	 dˆ fd„	Zdd„Zd„ Zdd„Zd„ Zd„ Zd	„ Z	d
„ Z
d„ Zd„ Zd„ Zˆ xZS )ÚInteractiveMigrationQuestionerNc                 ó�   •— t          ¦   «                              |||¬¦  «         |pt          t          j        ¦  «        | _        d S ©N)r   r   r   )Úsuperr   r   ÚsysÚstdoutÚprompt_output)r   r   r   r   r`   Ú	__class__s        €r   r   z'InteractiveMigrationQuestioner.__init__[   sL   ø€ õ 	‰Œ×ÒØ¨nÀgð 	ñ 	
ô 	
ð 	
ð +ÐG­m½C¼JÑ.GÔ.GˆÔÐÐr   c                 óp  — | j                              |› d�d¬¦  «         t          ¦   «         }|s|�|S |r|d                              ¦   «         dvrH| j                              dd¬¦  «         t          ¦   «         }|¯,|d                              ¦   «         dv°H|d                              ¦   «         dk    S )Nú Ú ©Úendingr   ÚynzPlease answer yes or no: Úy)r`   ÚwriteÚinputÚlower)r   ÚquestionÚdefaultÚresults       r   Ú_boolean_inputz-InteractiveMigrationQuestioner._boolean_inputc   sÂ   € ØÔ× Ò  H   ¸Ð Ñ;Ô;Ð;Ý‘”ˆØð 	˜'Ð-ØˆNØð 	˜F 1œIŸOšOÑ-Ô-°TÐ9Ð9ØÔ×$Ò$Ð%@ÈÐ$ÑLÔLÐLÝ‘W”WˆFð ð 	˜F 1œIŸOšOÑ-Ô-°TÐ9Ð9ð �aŒy�ŠÑ Ô  CÒ'Ð'r   c                 óÔ  — | j                              |› ¦  «         t          |¦  «        D ](\  }}| j                              d|dz   ›d|›�¦  «         Œ)| j                              dd¬¦  «         t          ¦   «         }	 	 t	          |¦  «        }d|cxk     rt          |¦  «        k    rn n|S n# t          $ r Y nw xY w| j                              d	d¬¦  «         t          ¦   «         }Œk)
Nrc   r   z) zSelect an option: rd   re   Tr   zPlease select a valid option: )r`   ri   Ú	enumeraterj   Úintr,   Ú
ValueError)r   rl   ÚchoicesÚiÚchoicern   Úvalues          r   Ú_choice_inputz,InteractiveMigrationQuestioner._choice_inputm   s"  € ØÔ× Ò  H Ñ/Ô/Ð/Ý" 7Ñ+Ô+ð 	Bð 	B‰IˆAˆvØÔ×$Ò$Ð$°!°a±%°%°%¸¸Ð%@ÑAÔAÐAÐAØÔ× Ò Ð!5¸bÐ ÑAÔAÐAÝ‘”ˆð		ð!Ý˜F™œ�ð �uÐ,Ð,Ò,Ð,¥ G¡¤Ò,Ð,Ð,Ð,Ð,Ø �Lð -øõ ð ð ð Ø�ðøøøð
 Ô×$Ò$Ð%EÈbÐ$ÑQÔQÐQÝ‘W”WˆFð		s   Â B/ Â/
B<Â;B<rd   c                 óš  — | j                              d¦  «         |r| j                              d|› d�¦  «         | j                              d¦  «         | j                              d¦  «         	 |rd                     |¦  «        }nd}| j                              |d	¬
¦  «         t          ¦   «         }|s|r|}|s| j                              d¦  «         nu|dk    rt	          j        d¦  «         nZ	 t          |i t          t          dœ¦  «        S # t          t          f$ r'}| j                              d|z  ¦  «         Y d}~nd}~ww xY wŒÝ)zÿ
        Prompt for a default value.

        The ``default`` argument allows providing a custom default value (as a
        string) which will be shown to the user and used as the return value
        if the user doesn't provide any other input.
        z/Please enter the default value as valid Python.zAccept the default 'z/' by pressing 'Enter' or provide another value.zxThe datetime and django.utils.timezone modules are available, so it is possible to provide e.g. timezone.now as a value.zType 'exit' to exit this promptTz[default: {}] >>> z>>> rd   re   z;Please enter some code, or 'exit' (without quotes) to exit.Úexitr   )Údatetimer   zInvalid input: %sN)r`   ri   Úformatrj   r^   rz   Úevalr{   r   ÚSyntaxErrorÚ	NameError)r   rm   ÚpromptÚcodeÚes        r   Ú_ask_defaultz+InteractiveMigrationQuestioner._ask_default~   s³  € ð 	Ô× Ò Ð!RÑSÔSÐSØð 	ØÔ×$Ò$ð* wð *ð *ð *ñô ð ð 	Ô× Ò ðFñ	
ô 	
ð 	
ð 	Ô× Ò Ð!BÑCÔCÐCð	FØð  Ø-×4Ò4°WÑ=Ô=��à�ØÔ×$Ò$ V°BÐ$Ñ7Ô7Ð7Ý‘7”7ˆDØð ˜Gð Ø�Øð 
FØÔ"×(Ò(ØQñô ð ð ð ˜’�Ý”˜‘”��ðFÝ  bµxÍXÐ*VÐ*VÑWÔWÐWøÝ#¥YÐ/ð Fð Fð FØÔ&×,Ò,Ð-@À1Ñ-DÑEÔEÐEÐEÐEÐEÐEÐEøøøøðFøøøð%	Fs   Ã3D ÄE	Ä"EÅE	c                 ó°   — | j         sN|                      d|› d|› d�ddg¦  «        }|dk    rt          j        d¦  «         n|                      ¦   «         S dS )	r6   z.It is impossible to add a non-nullable field 'z' to z{ without specifying a default. This is because the database needs something to populate existing rows.
Please select a fix:úbProvide a one-off default now (will be set on all existing rows with a null value for this column)ú6Quit and manually define a default value in models.py.é   é   N©r   rx   r^   rz   rƒ   ©r   r9   r:   rv   s       r   r;   z4InteractiveMigrationQuestioner.ask_not_null_addition¦   s†   € àŒ|ð 	+Ø×'Ò'ð(Àð (ð (Ø ð(ð (ð (ðBð Mðñô ˆFð ˜Š{ˆ{Ý”˜‘”��à×(Ò(Ñ*Ô*Ð*Øˆtr   c                 óÊ   — | j         s[|                      d|› d|› d�g d¢¦  «        }|dk    rt          S |dk    rt          j        d¦  «         n|                      ¦   «         S dS )r>   z-It is impossible to change a nullable field 'z' on zŠ to non-nullable without providing a default. This is because the database needs something to populate existing rows.
Please select a fix:)r…   zŠIgnore for now. Existing rows that contain NULL values will have to be handled manually, for example with a RunPython or RunSQL operation.r†   r‡   rˆ   N)r   rx   r   r^   rz   rƒ   rŠ   s       r   r?   z6InteractiveMigrationQuestioner.ask_not_null_alteration½   s“   € àŒ|ð 	+Ø×'Ò'ð(À
ð (ð (Ø ð(ð (ð (ð
	ð 	ð 	ñô ˆFð" ˜Š{ˆ{Ý#Ð#Ø˜1’�Ý”˜‘”��à×(Ò(Ñ*Ô*Ð*Øˆtr   c                 óV   — d}|                       ||||||j        j        fz  d¦  «        S )rA   z(Was %s.%s renamed to %s.%s (a %s)? [y/N]F)ro   ra   rU   )r   r:   rD   rE   rF   Úmsgs         r   rB   z)InteractiveMigrationQuestioner.ask_renameÙ   sF   € à8ˆØ×"Ò"ØàØØØØÔ(Ô1ðñð ñ

ô 

ð 
	
r   c                 ó\   — d}|                       ||j        |j        |j        fz  d¦  «        S )rH   z(Was the model %s.%s renamed to %s? [y/N]F)ro   r0   Úname)r   rJ   rK   r�   s       r   rI   z/InteractiveMigrationQuestioner.ask_rename_modelè   s>   € à8ˆØ×"Ò"ØØÔ(¨/Ô*>ÀÔ@TÐUñVàñ
ô 
ð 	
r   c                 ó.   — |                       dd¦  «        S )Nz°
Merging will only work if the operations printed above do not conflict
with each other (working on different fields or models)
Should these migration branches be merged? [y/N]F)ro   rN   s     r   rM   z(InteractiveMigrationQuestioner.ask_mergeñ   s%   € Ø×"Ò"ðAð ñ	
ô 
ð 	
r   c                 ó´   — | j         sP|                      d|› d|› d�ddg¦  «        }|dk    rt          j        d¦  «         n|                      d¬	¦  «        S d
S )rP   z#It is impossible to add the field 'z' with 'auto_now_add=True' to zf without providing a default. This is because the database needs something to populate existing rows.
zDProvide a one-off default now which will be set on all existing rowsr†   r‡   rˆ   ztimezone.now)rm   Nr‰   rŠ   s       r   rQ   z8InteractiveMigrationQuestioner.ask_auto_now_add_additionù   sˆ   € àŒ|ð 	AØ×'Ò'ð-°jð -ð -Ø*4ð-ð -ð -ð
$àLðñ
ô 
ˆFð ˜Š{ˆ{Ý”˜‘”��à×(Ò(°Ð(Ñ@Ô@Ð@Øˆtr   c                 óª   — | j         sKt          ¦   «         }|                      d|› d|› d�d|› d�dg¦  «        }|dk    rt          j        d¦  «         d	S )
rS   z!Callable default on unique field ú.zO will not generate unique values upon migrating.
Please choose how to proceed:
z›Continue making this migration as the first step in writing a manual migration to generate unique values described here: https://docs.djangoproject.com/en/z=/howto/writing-migrations/#migrations-that-add-unique-fields.z)Quit and edit field options in models.py.r‡   rˆ   N)r   r   rx   r^   rz   )r   r9   r:   Úversionrv   s        r   rT   zCInteractiveMigrationQuestioner.ask_unique_callable_default_addition  s”   € àŒ|ð 	Ý&Ñ(Ô(ˆGØ×'Ò'ð3°Jð 3ð 3Àð 3ð 3ð 3ðNð :AðNð Nð Nð
 @ðñ	ô ˆFð ˜Š{ˆ{Ý”˜‘”�Øˆtr   )NNNNr   )rd   )rU   rV   rW   r   ro   rx   rƒ   r;   r?   rB   rI   rM   rQ   rT   Ú__classcell__©ra   s   @r   rZ   rZ   Z   së   ø€ € € € € àNRðHð Hð Hð Hð Hð Hð(ð (ð (ð (ðð ð ð"&Fð &Fð &Fð &FðPð ð ð.ð ð ð8
ð 
ð 
ð
ð 
ð 
ð
ð 
ð 
ðð ð ð(ð ð ð ð ð ð r   rZ   c                   óB   ‡ — e Zd Z	 	 	 	 	 dˆ fd„	Zd„ Zd„ Zd„ Zd„ Zˆ xZS )	Ú!NonInteractiveMigrationQuestionerNr   c                 ól   •— || _         || _        t          ¦   «                              |||¬¦  «         d S r\   )Ú	verbosityÚlogr]   r   )r   r   r   r   rš   r›   ra   s         €r   r   z*NonInteractiveMigrationQuestioner.__init__$  sG   ø€ ð #ˆŒØˆŒÝ‰Œ×ÒØØ)Øð 	ñ 	
ô 	
ð 	
ð 	
ð 	
r   c           	      ó^   — | j         dk    r!|                      d|› d|› d|› d�¦  «         d S d S )Nr   úField 'ú' on model 'z' not migrated: r“   )rš   r›   )r   r9   r:   Úreasons       r   Úlog_lack_of_migrationz7NonInteractiveMigrationQuestioner.log_lack_of_migration4  sf   € ØŒ>˜AÒÐØ�HŠHð˜*ð ð °*ð ð Øðð ð ñô ð ð ð ð Ðr   c                 ó\   — |                       ||d¦  «         t          j        d¦  «         d S )NzIit is impossible to add a non-nullable field without specifying a defaultrˆ   ©r    r^   rz   r8   s      r   r;   z7NonInteractiveMigrationQuestioner.ask_not_null_addition;  s8   € à×"Ò"ØØðñ	
ô 	
ð 	
õ 	Œ�‰Œˆˆˆr   c                 óH   — |                       d|› d|› d�¦  «         t          S )Nr�   rž   z8' given a default of NOT PROVIDED and must be corrected.)r›   r   r8   s      r   r?   z9NonInteractiveMigrationQuestioner.ask_not_null_alterationE  sB   € à�Šð3�jð 3ð 3¨jð 3ð 3ð 3ñ	
ô 	
ð 	
õ Ðr   c                 ó\   — |                       ||d¦  «         t          j        d¦  «         d S )NzUit is impossible to add a field with 'auto_now_add=True' without specifying a defaultrˆ   r¢   r8   s      r   rQ   z;NonInteractiveMigrationQuestioner.ask_auto_now_add_additionM  s8   € à×"Ò"ØØð#ñ	
ô 	
ð 	
õ 	Œ�‰Œˆˆˆr   )NNNr   N)	rU   rV   rW   r   r    r;   r?   rQ   r•   r–   s   @r   r˜   r˜   #  sŠ   ø€ € € € € ð ØØØØð
ð 
ð 
ð 
ð 
ð 
ð ð ð ðð ð ðð ð ðð ð ð ð ð ð r   r˜   )r{   r$   r'   r^   Údjango.appsr   Údjango.core.management.baser   Údjango.db.modelsr   Údjango.utilsr   Údjango.utils.versionr   Úloaderr	   r   rZ   r˜   r7   r   r   ú<module>r«      s2  ðØ €€€Ø Ð Ð Ð Ø 	€	€	€	Ø 
€
€
€
à Ð Ð Ð Ð Ð Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø )Ð )Ð )Ð )Ð )Ð )Ø !Ð !Ð !Ð !Ð !Ð !Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1à #Ð #Ð #Ð #Ð #Ð #ðHð Hð Hð Hð Hñ Hô Hð HðVFð Fð Fð Fð FÐ%8ñ Fô Fð FðR2ð 2ð 2ð 2ð 2Ð(;ñ 2ô 2ð 2ð 2ð 2r   