o
    [h=                     @   s\   d dl mZ d dlZddlmZ dadZdZeZ	dd Z
G d	d
 d
eZdd ZdZdZdS )    )PathN   )BaseCommandz
from otree.api import *
c = cu
from otree.api import (
    models,
    widgets,
    BaseConstants,
    BaseSubsession,
    BaseGroup,
    BasePlayer,
    Currency as c,
    currency_range,
)
zx
from otree.api import Currency as c, currency_range
from ._builtin import Page, WaitPage
from .models import Constants
c                 C   s    t dt d|   td7 ad S )N	z. r   )print_function
item_indextxt r
   /home/ubuntu/experiments/live_experiments/Pythonexperiments/Otree/venv/lib/python3.10/site-packages/otree/cli/update_my_code.pyprint_numbered!   s   r   c                   @   s   e Zd ZdZdd ZdS )CommandFc                 O   s   t  D ]}t| qd S N)scanr   )selfargsoptionsmsgr
   r
   r   handle*   s   

zCommand.handleN)__name__
__module____qualname__Zsomething_changedr   r
   r
   r
   r   r   '   s    r   c                  #   s    t d} | d}|D ]}d| v r$t tjjd }|| qt dd}dD ]}||v r;d| d	V  q.d
|v rCdV  | dD ]<}|d d v rY| dV  d v rc| dV  d v rm| dV  g d}t fdd|D r| dt	 V  qH| dD ]}|jd}|
 s|| td qt d}	t d}
|	
 r|

 s|	|
 td | dD ]X}|d d v rd| d V  d! v rd| d"V  g d}t fd#d|D r| dt V  d$ v r| d%t V  d&D ]}d'| d( v r| d)| d*V  q q| d+D ]N}|d d, v r0| d-d. V  d/ v r<t|d0 V  d1 v rHt|d2 V  d3D ]}d4| }d5| }| v rgt|d6| d7| d V  qJqt d8}|
 r|jdd9D ]}|d:r| d;V  qztt d S )<N.z*/_builtin/__init__.pyZz_autocompletez!app_template/_builtin/__init__.pyzsettings.pyutf8)zimport otree.settingsz*otree.settings.augment_settings(globals())z$from boto.mturk import qualificationzimport dj_database_urlzYour settings.py contains "z". You should delete this line.zDATABASES = {z?settings.py contains a DATABASES setting. you should delete it.z*/models.pyzwidgets.Sliderz uses widgets.Slider. This widget has been removed from oTree. You should instead remove this widget and use an <input type="range"> in the template (see the docs).zmodels.DecimalFieldzE uses models.DecimalField. You should use models.FloatField instead. z*subsession = models.ForeignKey(Subsession)z= uses models.ForeignKey. You should delete all foreign keys. )zfrom otree.commonzfrom otree.constantszfrom otree.modelszfrom otree.dbc                 3       | ]}| v V  qd S r   r
   .0	substringr   r
   r   	<genexpr>c       zscan.<locals>.<genexpr>zP imports non-API modules from otree. You should change the lines at the top to:
z
*/views.pyzpages.pyz'AUTOMATIC: renamed views.py to pages.pyz_templates/global/Base.htmlz_templates/global/Page.htmlz7AUTOMATIC: renamed global/Base.html to global/Page.htmlz
*/pages.pyzform_model = models.PlayerzIn zI, you should change:
form_model = models.Player
to:
form_model = 'player'zform_model = models.GroupzG, you should change:
form_model = models.Group
to:
form_model = 'group'c                 3   r   r   r
   r   r   r
   r   r      r   Zvars_for_all_templatesz: )minmaxchoiceserror_message_(z- contains a field validation function (FIELD_z). This function should be moved to models.py. See here: https://otree.readthedocs.io/en/self/misc/version_history.html#new-format-for-form-validationz*/templates/*/*.htmlz {% extends "global/Base.html" %} zEstarts with {% extends "global/Base.html" %}. You should remove that.zwith label=zM: the formfield tag should not use "with label=". Just change it to "label=" z|floatformatz: |floatformat is not available because it comes from Django. You should replace it with to0/to1/to2, for example {{ my_number|to2 }})toggletargetparentshowzdata-zdata-bs-z: In Bootstrap 5, z has been renamed to z_static/global/custom.css)encodingzinput {zN: you should delete the styling for "input" (or just delete all file contents))r   glob	read_textotree__file__r)   joinpath
write_textanyNEW_MODELS_PY_IMPORTSexistsrenamer   NEW_PAGES_PY_IMPORTSVARS_FOR_ALL_TEMPLATES_MSGstropen
startswithDONE_MSG)rootZ	_builtinspthnew_textZsettings_pyr   Z
substringsZviews_pyZpages_pyZ	base_htmlZ	page_htmlattrZoldstyleZnewstyleZcustom_css_pthliner
   r   r   r   /   s   













	
r   zu
Done. all files checked.
(If you want, you can also run "otree remove_self" to switch to the new 'no self' format) 
aT  
****************************************************************************************************************
* vars_for_all_templates() will not be called automatically. You should rename it to something like "shared_vars", 
* then call it from each page's vars_for_template. For example:
*
* def vars_for_template(self):
*    return shared_vars(self)
*    
* def vars_for_template(self):
*    # combine it with the page's vars
*    return {'a': 1, 'b': 2, **shared_vars(self)}
****************************************************************************************************************
)pathlibr   r.   baser   r   r3   r6   printr   r   r   r   r;   r7   r
   r
   r
   r   <module>   s     