
    Bh                     R    d dl mZ d dlmZ d Zd Z G d dej                        Zy)    )unicode_literals)
migrationsc              #      K   | j                   j                  |      j                  d      j                  dd      }|D ]  }| t	        | |      D ]  }|   yw)zr
    Returns the a generator of primary keys which represent
    descendants of the given plugin ID (root_id)
    )parentpositionpkTflatN)objectsfilterorder_byvalues_listget_descendant_ids)model_classroot_ididschild_ids       `/home/dcms/DCMS/lib/python3.12/site-packages/cms/migrations/0024_set_plugin_absolute_position.pyr   r      sj      			w		*		T	%   *;A 	HN	s   AA c                    |j                   j                  }| j                  dd      }| j                  dd      }|j                  j	                  |      j                         }|j                  j	                  |      j                  dd      j                         }|D ]  }|D ]  }d}	|j                  j                  |      }
|
j                  d	      j                  d
      j                  dd      }|D ]b  }|
j                  |      j                  |	       |	dz  }	t        ||      D ])  }|
j                  |      j                  |	       |	dz  }	+ d   y )Ncms	CMSPluginPlaceholderlanguageTr	      )r   )parent__isnullr   r   )r   )r   )r   )
connectionalias	get_modelr   usingallr   distinctcmsplugin_setr   r   updater   )appsschema_editordb_aliasr   r   placeholdersall_languagesplaceholderr   r   pluginsroot_plugin_idsr   desc_ids                 r   set_plugin_absolute_positionr-      sX   ''--Huk2I..6K&&,,X6::<L		x	Zd	+	  $ "% 	"HH!//666IGt,*%T-	  + "'*1181D11)WM "GNNgN.55x5HMH"	"	""    c                   8    e Zd ZdgZ ej
                  e      gZy)	Migration)r   0023_placeholder_source_fieldN)__name__
__module____qualname__dependenciesr   	RunPythonr-   
operations r.   r   r0   r0   ;   s(     	1L
 	
9:Jr.   r0   N)
__future__r   	django.dbr   r   r-   r0   r8   r.   r   <module>r;      s(    '  ("@
$$ r.   