
    Bh                     J    d dl mZ d dlmZ ddlmZ d Zd Z G d de      Zy	)
    )unicode_literals)
migrations   )IrreversibleMigrationc                    | j                  dd      }|j                  j                  }|j                  j	                  |      j                  d      }|j                  j	                  |      j                  ddd      }|j                         D ]L  }|j                  j                  dd       |j                  |j                  	      j                  d
d
       N y
)a
  
    Prior to 3.5, pages would be marked as "pending"
    when users tried to publish a page with an unpublished parent.
    This is no longer allowed, as a result any page that's set as
    published but does not have a public version is marked as unpublished.
    cmsPageTpublisher_is_draft)title_set__publishedr   publisher_public__isnullFr   )	publishedpublisher_statepkN)publication_datepublication_end_date)
	get_model
connectionaliasobjectsusingfilterdistinct	title_setupdater   )appsschema_editorr	   db_aliasdraft_pagesnever_published_pagespages          P/home/dcms/DCMS/lib/python3.12/site-packages/cms/migrations/0019_set_pagenode.pyunpublish_never_published_pagesr$   	   s     >>%(D''--H,,$$X.555NK LL..x8??!!% @  &..0 
 	 	
 	dgg&--!!% 	. 	

    c                 t   | j                  dd      }| j                  dd      }|j                  j                  }|j                  j	                  |      j                  d      }|j                  j	                  |      j                  d      }|j                  j                         D ci c]  }|j                  | }}|D ]l  }	||	j                     |	_        |	j                  dg       |	j                  s7|j                  |	j                  	      j                  |	j                  
       n y c c}w )Nr   r	   TreeNodeTr
   Fnode)update_fieldsr   )r(   )r   r   r   r   r   r   allpathr(   savepublisher_public_idr   )
r   r   r	   r'   r   r    public_pagesr(   nodes_by_path
draft_pages
             r#   set_page_nodesr1   $   s
   >>%(D~~eZ0H''--H,,$$X.555NK<<%%h/66%6PL191A1A1E1E1GHTYY_HMH! `
'
8
vh/)):#A#ABIIzI_` Is   -D5c                   n     e Zd ZdgZ ej
                  e       ej
                  e      gZd fd	Z	 xZ
S )	Migration)r   0018_create_pagenodec                 0   |j                   }|j                  j                  |j                         d      D cg c]  }|j                   }}d|v rt
        |   |||      S | j                  D ]  }|j                  | j                  |         |S c c}w )Ncms_pagemigration_0018_control)
r   introspectionget_table_descriptioncursornamesuperapply
operationsstate_forwards	app_label)	selfproject_stater   collect_sqlr   columncolumn_names	operation	__class__s	           r#   r=   zMigration.apply?   s    "--
 $$:::;L;L;NPZ[
"FKK
 

 $|37={KK
  	DI$$T^^]C	D
s   B)F)__name__
__module____qualname__dependenciesr   	RunPythonr$   r1   r>   r=   __classcell__)rG   s   @r#   r3   r3   4   sC     	(L
 	
<=
^,J
 r%   r3   N)	
__future__r   	django.dbr    r   r$   r1   r3    r%   r#   <module>rR      s&    '   #
6` % r%   