ó
    ¼Rj4  ã                   ó¬   • S SK r S SKrS SKrS SKrS SKJr  S SKJr  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g)é    N)Úapps)ÚOutputWrapper)ÚNOT_PROVIDED)Útimezone)Úget_docs_versioné   )ÚMigrationLoaderc                   óR   • \ rS rSrSrSS jrS rS rS rS r	S	 r
S
 rS rS rSrg)ÚMigrationQuestioneré   z»
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                 ó`   • U=(       d    0 U l         U=(       d
    [        5       U l        X0l        g ©N)ÚdefaultsÚsetÚspecified_appsÚdry_run)Úselfr   r   r   s       ÚKD:\diplom_project\venv\Lib\site-packages\django/db/migrations/questioner.pyÚ__init__ÚMigrationQuestioner.__init__   s!   € Ø Ÿ BˆŒØ,×5´³ˆÔØ�ó    c                 ó,  • XR                   ;   a  g [        R                  " U5      n[        R                  " UR                  5      u  p4Uc  U R                  R                  SS5      $  [        R                  " U5      n[        USS5      (       a>  [        R                  " [        R                  R                  UR                   5      5      nOW[#        US5      (       aF  [%        UR&                  5      S:”  a  g[        R                  " [)        UR&                  5      S   5      n[+        S	 W 5       5      (       + $ ! [         a    U R                  R                  SS5      s $ f = f! [,         a    U R                  R                  SS5      s $ f = f)
z2Should we create an initial migration for the app?TÚask_initialFNÚ__file__Ú__path__r   r   c              3   óR   #   • U  H  oS :w  d  M
  UR                  S5      v •  M     g7f)z__init__.pyz.pyN)Úendswith)Ú.0Úxs     r   Ú	<genexpr>Ú2MigrationQuestioner.ask_initial.<locals>.<genexpr>7   s$   é € ÐV²i°ÈÑCUÓ,˜1Ÿ:™: e×,Ð,²iùs   ‚	'�')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   ÚMigrationQuestioner.ask_initial   sT  € ð ×+Ñ+Ó+Øð
	;Ü×,Ò,¨YÓ7ˆJô %4×$EÒ$EÀj×FVÑFVÓ$WÑ!ÐØ!Ñ)à—=‘=×$Ñ$ ]°EÓ:Ð:ð	WÜ )× 7Ò 7Ð8NÓ OÐô Ð(¨*°d×;Ñ;ÜŸJšJ¤r§w¡w§¡Ð7H×7QÑ7QÓ'RÓS‘	ÜÐ*¨J×7Ñ7ÜÐ(×1Ñ1Ó2°QÓ6Ø ÜŸJšJ¤tÐ,=×,FÑ,FÓ'GÈÑ'JÓK�	ÜÑV±iÓVÓVÔVÐVøô# ó 	;Ø—=‘=×$Ñ$ ]°EÓ:Ò:ð	;ûô ó 	;Ø—=‘=×$Ñ$ ]°EÓ:Ò:ð	;ús#   ’D> Á*E* Ä>&E'Å&E'Å*&FÆFc                 ó   • g)ú#Adding a NOT NULL field to a model.N© ©r   Ú
field_nameÚ
model_names      r   Úask_not_null_additionÚ)MigrationQuestioner.ask_not_null_addition9   ó   € ð r   c                 ó   • g)ú"Changing a NULL field to NOT NULL.Nr;   r<   s      r   Úask_not_null_alterationÚ+MigrationQuestioner.ask_not_null_alteration>   rA   r   c                 ó:   • U R                   R                  SS5      $ )úWas this field really renamed?Ú
ask_renameF©r   r$   )r   r>   Úold_nameÚnew_nameÚfield_instances        r   rH   ÚMigrationQuestioner.ask_renameC   s   € à�}‰}× Ñ  ¨uÓ5Ð5r   c                 ó:   • U R                   R                  SS5      $ )úWas this model really renamed?Úask_rename_modelFrI   )r   Úold_model_stateÚnew_model_states      r   rP   Ú$MigrationQuestioner.ask_rename_modelG   s   € à�}‰}× Ñ Ð!3°UÓ;Ð;r   c                 ó:   • U R                   R                  SS5      $ )z)Should these migrations really be merged?Ú	ask_mergeFrI   ©r   r3   s     r   rU   ÚMigrationQuestioner.ask_mergeK   s   € à�}‰}× Ñ  ¨eÓ4Ð4r   c                 ó   • g)ú(Adding an auto_now_add field to a model.Nr;   r<   s      r   Úask_auto_now_add_additionÚ-MigrationQuestioner.ask_auto_now_add_additionO   rA   r   c                 ó   • g)ú.Adding a unique field with a callable default.Nr;   r<   s      r   Ú$ask_unique_callable_default_additionÚ8MigrationQuestioner.ask_unique_callable_default_additionT   rA   r   )r   r   r   )NNN)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r?   rD   rH   rP   rU   rZ   r^   Ú__static_attributes__r;   r   r   r   r      s5   † ñôò
Wò<ò
ò
6ò<ò5òõ
r   r   c                   ór   ^ • \ rS rSr SU 4S jjrSS jrS rSS jrS rS r	S r
S	 rS
 rS rS rSrU =r$ )ÚInteractiveMigrationQuestioneréZ   c                 óp   >• [         TU ]  XUS9  U=(       d    [        [        R                  5      U l        g ©N)r   r   r   )Úsuperr   r   ÚsysÚstdoutÚprompt_output)r   r   r   r   rn   Ú	__class__s        €r   r   Ú'InteractiveMigrationQuestioner.__init__[   s4   ø€ ô 	‰ÑØÀgð 	ñ 	
ð +×G¬m¼C¿J¹JÓ.GˆÕr   c                 ó\  • U R                   R                  U S3SS9  [        5       nU(       d  Ub  U$ U(       a  US   R                  5       S;  aF  U R                   R                  SSS9  [        5       nU(       d  M-  US   R                  5       S;  a  MF  US   R                  5       S:H  $ )NÚ Ú ©Úendingr   ÚynzPlease answer yes or no: Úy)rn   ÚwriteÚinputÚlower)r   ÚquestionÚdefaultÚresults       r   Ú_boolean_inputÚ-InteractiveMigrationQuestioner._boolean_inputc   sœ   € Ø×Ñ× Ñ  H :¨Q ¸Ð Ñ;Ü“ˆÞ˜'Ñ-ØˆNÞ˜F 1™IŸO™OÓ-°TÓ9Ø×Ñ×$Ñ$Ð%@ÈÐ$ÑLÜ“WˆF÷ �&˜F 1™IŸO™OÓ-°TÕ9ð �a‰y�‰Ó  CÑ'Ð'r   c                 ó´  • U R                   R                  U 5        [        U5       H+  u  p4U R                   R                  SUS-   < SU< 35        M-     U R                   R                  SSS9  [        5       n  [	        U5      nSUs=:  a  [        U5      ::  a   U$   O U R                   R                  SSS9  [        5       nMN  ! [         a     N2f = f)	Nrr   r   z) zSelect an option: rs   rt   r   zPlease select a valid option: )rn   rx   Ú	enumeratery   Úintr/   Ú
ValueError)r   r{   ÚchoicesÚiÚchoicer}   Úvalues          r   Ú_choice_inputÚ,InteractiveMigrationQuestioner._choice_inputm   sÏ   € Ø×Ñ× Ñ  H :Ô/Ü" 7Ö+‰IˆAØ×Ñ×$Ò$°!°a´%ºÐ%@ÖAñ ,à×Ñ× Ñ Ð!5¸bÐ ÑAÜ“ˆØð!Ü˜F›�ð �uÕ,¤ G£Ô,Ø �Lò -à×Ñ×$Ñ$Ð%EÈbÐ$ÑQÜ“WˆFñ øô ó Ùðús   Á=C
 Ã

CÃCc                 ó¼  • U R                   R                  S5        U(       a  U R                   R                  SU S35        U R                   R                  S5        U R                   R                  S5         U(       a  SR                  U5      nOSnU R                   R                  USS	9  [        5       nU(       d	  U(       a  UnU(       d  U R                   R                  S
5        O6US:X  a  [        R
                  " S5        O [        U0 [        [        S.5      $ Mª  ! [        [        4 a(  nU R                   R                  SU-  5         SnAN5SnAff = f)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 promptz[default: {}] >>> z>>> rs   rt   z;Please enter some code, or 'exit' (without quotes) to exit.Úexitr   )Údatetimer   zInvalid input: %sN)rn   rx   Úformatry   rl   r‹   ÚevalrŒ   r   ÚSyntaxErrorÚ	NameError)r   r|   ÚpromptÚcodeÚes        r   Ú_ask_defaultÚ+InteractiveMigrationQuestioner._ask_default~   s<  € ð 	×Ñ× Ñ Ð!RÔSÞØ×Ñ×$Ñ$Ø& w ið 0)ð *ôð 	×Ñ× Ñ ðFô	
ð 	×Ñ× Ñ Ð!BÔCØÞØ-×4Ñ4°WÓ=‘à�Ø×Ñ×$Ñ$ V°BÐ$Ñ7Ü“7ˆDÞžGØ�ÞØ×"Ñ"×(Ñ(ØQõð ˜“Ü—’˜•ðFÜ  b´xÌXÑ*VÓWÐWñ# øô$ $¤YÐ/ó FØ×&Ñ&×,Ñ,Ð-@À1Ñ-D×EÑEûðFús   Ä	D# Ä#EÄ3EÅEc                 ó¶   • U R                   (       dH  U R                  SU SU S3SS/5      nUS:X  a  [        R                  " S5        gU R	                  5       $ g)	r:   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   rˆ   rl   r‹   r”   ©r   r=   r>   r†   s       r   r?   Ú4InteractiveMigrationQuestioner.ask_not_null_addition¦   ss   € à�|�|Ø×'Ñ'Ø@ÀÀð MØ �\ð "'ð(ðBð MðóˆFð ˜‹{Ü—’˜”ð ð ×(Ñ(Ó*Ð*Ør   c                 óÎ   • U R                   (       dT  U R                  SU SU S3/ SQ5      nUS:X  a  [        $ US:X  a  [        R                  " S5        gU R                  5       $ g)rC   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   rˆ   r   rl   r‹   r”   rœ   s       r   rD   Ú6InteractiveMigrationQuestioner.ask_not_null_alteration½   st   € à�|�|Ø×'Ñ'Ø?À
¸|ð LØ �\ð "'ð(ò
	óˆFð" ˜‹{Ü#Ð#Ø˜1“Ü—’˜”ð ð ×(Ñ(Ó*Ð*Ør   c                 ób   • SnU R                  UUUUUUR                  R                  4-  S5      $ )rG   z(Was %s.%s renamed to %s.%s (a %s)? [y/N]F)r~   ro   r`   )r   r>   rJ   rK   rL   Úmsgs         r   rH   Ú)InteractiveMigrationQuestioner.ask_renameÙ   sG   € à8ˆØ×"Ñ"ØàØØØØ×(Ñ(×1Ñ1ðñð ó

ð 
	
r   c                 ór   • SnU R                  UUR                  UR                  UR                  4-  S5      $ )rO   z(Was the model %s.%s renamed to %s? [y/N]F)r~   r3   Úname)r   rQ   rR   r¡   s       r   rP   Ú/InteractiveMigrationQuestioner.ask_rename_modelè   sB   € à8ˆØ×"Ñ"ØØ×(Ñ(¨/×*>Ñ*>À×@TÑ@TÐUñVàó
ð 	
r   c                 ó&   • U R                  SS5      $ )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)r~   rV   s     r   rU   Ú(InteractiveMigrationQuestioner.ask_mergeñ   s    € Ø×"Ñ"ðAð ó	
ð 	
r   c                 ó´   • U R                   (       dG  U R                  SU SU S3SS/5      nUS:X  a  [        R                  " S5        g
U R	                  SS	9$ g
)rY   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)r|   Nr›   rœ   s       r   rZ   Ú8InteractiveMigrationQuestioner.ask_auto_now_add_additionù   st   € à�|�|Ø×'Ñ'Ø5°j°\ð B*Ø*4¨ð 6,ð-ð
$àLðó
ˆFð ˜‹{Ü—’˜”ð ð ×(Ñ(°Ð(Ð@Ð@Ør   c                 ó°   • U R                   (       dE  [        5       nU R                  SU SU S3SU S3S/5      nUS:X  a  [        R                  " S5        g	)
r]   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   rˆ   rl   r‹   )r   r=   r>   Úversionr†   s        r   r^   ÚCInteractiveMigrationQuestioner.ask_unique_callable_default_addition  su   € à�|�|Ü&Ó(ˆGØ×'Ñ'Ø3°J°<¸qÀÀð M2ð 3ð9ð :A¸	ð BMðNð
 @ðó	ˆFð ˜‹{Ü—’˜”Ør   )rn   )NNNNr   )rs   )r`   ra   rb   rc   r   r~   rˆ   r”   r?   rD   rH   rP   rU   rZ   r^   re   Ú__classcell__©ro   s   @r   rg   rg   Z   sE   ø† àNR÷Hô(òô"&FòPò.ò8
ò
ò
ò÷(ð r   rg   c                   óN   ^ • \ rS rSr     SU 4S jjrS rS rS rS rSr	U =r
$ )	Ú!NonInteractiveMigrationQuestioneri#  c                 ó<   >• X@l         XPl        [        TU ]  UUUS9  g rj   )Ú	verbosityÚlogrk   r   )r   r   r   r   r³   r´   ro   s         €r   r   Ú*NonInteractiveMigrationQuestioner.__init__$  s*   ø€ ð #ŒØŒÜ‰ÑØØ)Øð 	ò 	
r   c           	      ó\   • U R                   S:”  a  U R                  SU SU SU S35        g g )Nr   úField 'ú' on model 'z' not migrated: r«   )r³   r´   )r   r=   r>   Úreasons       r   Úlog_lack_of_migrationÚ7NonInteractiveMigrationQuestioner.log_lack_of_migration4  s;   € Ø�>‰>˜AÓØ�H‰HØ˜*˜ \°*°Ð=MØ�(˜!ðõð r   c                 óV   • U R                  UUS5        [        R                  " S5        g )NzIit is impossible to add a non-nullable field without specifying a defaultrš   ©rº   rl   r‹   r<   s      r   r?   Ú7NonInteractiveMigrationQuestioner.ask_not_null_addition;  s(   € à×"Ñ"ØØðô	
ô 	�Š��r   c                 ó>   • U R                  SU SU S35        [        $ )Nr·   r¸   z8' given a default of NOT PROVIDED and must be corrected.)r´   r   r<   s      r   rD   Ú9NonInteractiveMigrationQuestioner.ask_not_null_alterationE  s-   € à�‰Ø�j�\ ¨j¨\ð :2ð 3ô	
ô Ðr   c                 óV   • U R                  UUS5        [        R                  " S5        g )NzUit is impossible to add a field with 'auto_now_add=True' without specifying a defaultrš   r½   r<   s      r   rZ   Ú;NonInteractiveMigrationQuestioner.ask_auto_now_add_additionM  s(   € à×"Ñ"ØØð#ô	
ô 	�Š��r   )r´   r³   )NNNr   N)r`   ra   rb   rc   r   rº   r?   rD   rZ   re   r®   r¯   s   @r   r±   r±   #  s2   ø† ð ØØØØ÷
ò òò÷ð r   r±   )rŒ   r'   r*   rl   Údjango.appsr   Údjango.core.management.baser   Údjango.db.modelsr   Údjango.utilsr   Údjango.utils.versionr   Úloaderr	   r   rg   r±   r;   r   r   Ú<module>rÉ      sM   ðÛ Û Û 	Û 
å Ý 5Ý )Ý !Ý 1å #÷Hñ HôVFÐ%8ô FôR2Ð(;õ 2r   