
    h%                        d dl Z d dlmZ d dlmZ d dlmZmZ ddlm	Z	 i Z
i Zi Zg Zdej                  v rrd dlmZ ej#                  ej                         ej#                  ej                         ej%                  ej&                         e
j#                  ej                         d	ej                  v rWd d
lmZ ej#                  ej                         ej#                  ej                         ej%                  ej&                         dej                  v rWd dlmZ ej#                  ej,                         ej#                  ej                         ej%                  ej&                          eedd      Zer eee      regZeD ]  Z	  e j8                  e      Zej#                  ej                         ej#                  ej                         ej%                  ej&                          eed      re
j#                  ej                          d Z!dZ"dZ# G d de	      Z$y# e$ r  e de d       Y w xY w)    N)apps)settings)
connectionmodels   )SubcommandsCommanddjangocms_bootstrap4)bootstrap4_migrationdjangocms_styledlink)styled_link_migrationdjangocms_icon)icon_migration(DJANGOCMS_FRONTEND_ADDITIONAL_MIGRATIONSplugin_namesz*Warning: can not import migration module: .c           
         d}t         j                         D ]  \  }}|j                  d      \  }}|j                  dd      \  }}|j                  dd      \  }	}
|| j                  v rD | j
                  ||      } | j
                  |	|
      }|j                  j                         D ]  } |       }|j                  j                         D cg c]  }|j                   }}|j                  |_        |j                  |_        |j                  |_        |j                  |_        |j                  |_        |j                   |_        t#        |d      r3|j$                  |_        |j&                  |_        |j(                  |_        |
t*        v r	t*        |
   n|
dz   |_        |D ]`  }|t.        v rt/        |   ||       d|v r|j                  d      \  }}n||}}|d   dk(  r|dd nt1        ||      }|d	k(  rd }||v rt3        |||       kt5        |t6        j8                        rHd
j;                  |j                  j<                  |j                  j>                        |j@                  d}nt5        |t6        jB                        rkd
j;                  |jD                  j                  j<                  |jD                  j                  j>                        tG        |jI                  dd            d}||jJ                  |<   c |jM                          tO        jP                         5 }d|j                  jR                   d|j                   d}tN        jT                  dvr|jW                  dd      }|jY                  |       d d d        |dz  }t[        |dd        t[        | d        |rt[        d| d       |S c c}w # 1 sw Y   KxY w)Nr   z -> r   r   depthPlugin( z{}.{})modelpkr   T)flat)r   p_keyszDELETE FROM `z` WHERE cmsplugin_ptr_id=;)mysqlsqlite`"7)endz not installed.z	Migrated z	 plugins.).plugin_migrationsitemssplitrsplit
all_models	get_modelobjectsall_meta
get_fieldsnameidplaceholderparentpositionlanguagecreation_datehasattrr   numchildpathr   plugin_typedata_migrationgetattrsetattr
isinstancer   Modelformat	app_label
model_namer   QuerySetr   listvalues_listconfigsaver   cursordb_tablevendorreplaceexecuteprint)r   schema_editorcntplugin_modelfieldsoldnewold_app	old_modelnew_app	new_modelOldPluginModelNewPluginModelobjnew_objfieldnew_obj_fields	old_field	new_fieldvaluerF   sql_commands                         j/home/dcms/DCMS/lib/python3.12/site-packages/djangocms_frontend/management/commands/subcommands/migrate.pymigrate_to_djangocms_frontendra   8   s   
C 1 7 7 9 B/f%%f-S ZZQ/ ZZQ/doo%+T^^GY?N+T^^GY?N%--113 8,(*:A--:R:R:T!U%**!U!U VV
&)oo#!$#&<< #&<< (+(9(9%3($'IIGM'*||G$#&88GLAJlAZl9&=`ilt`t## >E.&u-c7;!U?38;;v3F0Iy38%yI3<Q<33F	!BGTWYbLc B;$(E$6#GY>)%>-4^^(-(=(=(-(>(>.& +0(()" ",E6??!C-4^^(-(9(9(C(C(-(9(9(D(D.& /353D3DTPT3D3U.V)" 9>GNN95=>> &&( 0F$1#))2D2D1EE^_b_e_e^ffg"hK!((0CC&1&9&9#s&CNN;/0 qQd+q8,v WI_-.EB/F 	#i()Jw "V\0 0s   O1AOO!au  
You have djangocms_blog installed. Consider adding the following
lines to your settings.py:

    from django.utils.translation import getext_lazy as _

    DJANGOCMS_FRONTEND_LINK_MODELS = [
        {
            "type": _("Blog pages"),
            "class_path": "djangocms_blog.models.Post",
            "filter": {"publish": True, "app_config_id": 1},
            "search": "translations__title",
        },
    ]

This will allow editors to directly link to blog posts. Also,
blog posts can easily link amongst themselves.

See for https://djangocms-frontend.readthedocs.io/en/latest/howto_guides.html
for more information.
z
You may want to consider allowing editors to directly link to
a page generated by these models.

See for https://djangocms-frontend.readthedocs.io/en/latest/howto_guides.html
for more information.
c                   &    e Zd ZdZdZd Zd Zd Zy)Migratez;Migrates plugins djangocms_bootstrap4 to djangocms_frontendmigratec                    t         j                  j                         }d|vr5| j                  j	                  | j
                  j                  d             y | j                          t        t        dd       | j                          y y )N!djangocms_frontend_frontenduiitemz\I cannot find djangocms-frontend's tables in the database. Did you run
./manage.py migrate ?DJANGOCMS_FRONTEND_LINK_MODELS)r   introspectiontable_namesstdoutwritestyleERRORra   r:   r   check_for_link_targets)selfargsoptionstabless       r`   handlezMigrate.handle   sx    ))557.f<KK

  s
 **,8=tDL'') M    c                     ddl m} | j                  j                  | j                  j                  d             | j                  j                  | j                  j                  d             t        t        d       }g }|j                  j                         D ]  }t        t        D cg c]  }||j                  v  c}      s-|j                  |vs<|j                  |j                         | j                  j                  | j                  j                  |j                   d              |sS|r5| j                  j                  | j                  j                  d             y | j                  j                  d       y y c c}w )Nr   )	CMSPluginzMigrating pluginsz=================z not migrated.zSuccessfully migrated plugins.zNothing to migrate)cms.models.pluginmodelrv   rj   rk   rl   SUCCESSra   r   r*   r+   anyplugin_prefixesr8   appendWARNING)ro   rv   changesnot_migratedpluginprefixs         r`   ra   z%Migrate.migrate_to_djangocms_frontend   s1   4$**,,-@AB$**,,-@AB/d;''++- 	aFOVFf000OP%%\9 ''(:(:;KK%%djj&8&8F<N<N;O~9^&_`		a
 !!$**"4"45U"VW!!"67	 	 Ps   +F
c                    | j                   j                          | j                   j                  | j                  j                  d             | j                   j                  | j                  j                  d             d}d}t        j
                  j                         D ]  \  }}|dk7  ro|j                         D ]\  \  }}t        |d      s|dz  }| j                   j                  | j                  j                  d| d	|j                   d
             ^ |dk(  sd} |r| j                   j                  | j                  j                  | d             |r9| j                   j                  | j                  j                  t                     y | j                   j                  | j                  j                  t                     y | j                   j                  d       y )Nz7Checking installed apps for potential link destinationsz7=======================================================Fr   cmsget_absolute_urlr   zApp z's z& model is a suitable link destination.djangocms_blogTz# potential link destinations found.z3No further link destinations found. Setup complete.)rj   rk   rl   rx   r   r(   r%   r5   NOTICE__name__r|   blog_exampledoc_reference)ro   blogcountapp
app_models_r   s          r`   rn   zMigrate.check_for_link_targets   s   $**,,-fgh$**,,-fgh#446 		OCe| * 0 0 2 HAuu&89
)) JJ--SEU^^<LLr.st &&		 KKdjj00E7:]1^_`!!$**"4"4\"BC!!$**"4"4]"CD KKSTrt   N)r   
__module____qualname__helpcommand_namers   ra   rn    rt   r`   rc   rc      s    HDL*8$Urt   rc   )%	importlibdjango.appsr   django.confr   	django.dbr   r   baser   r   r$   r9   rz   r(   djangocms_frontend.managementr
   updater{   plugin_prefixr   r   plugin_migrationr:   additional_migrationsr<   strmigration_module_pathimport_modulemigration_moduler5   ModuleNotFoundErrorrK   ra   r   r   rc   r   rt   r`   <module>r      s*       ( $   T__,B1CCD.==>/==>,99:T__,C2DDE/>>?0>>?t&<^<<=.778>778*TVZ[ '-!6 7!6 	Y	Y6y667LM$$%5%G%GH!!"2"A"AB""#3#A#AB'8##$4$A$AB	YGT,<U  <U[ # 	Y>?T>UUVWX	Ys   BH++H?>H?