a
    Dg                     @   sb   d dl mZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 G dd deZedd	d Zd
S )    )settings)Model)gettext_lazy)hooks)Localec                   @   s   e Zd ZdZG dd dZdS )SimpleTranslationa"  
    SimpleTranslation, dummy model to create the `submit_translation` permission.

    We need this model to be concrete or the following management commands will misbehave:
    - `remove_stale_contenttypes`, will drop the perm
    - `dump_data`, will complain about the missing table
    c                   @   s   e Zd Zg ZdedfgZdS )zSimpleTranslation.MetaZsubmit_translationzCan submit translationsN)__name__
__module____qualname__Zdefault_permissions_Zpermissions r   r   h/var/www/lab.imftr.de/x/nb_venv/lib/python3.9/site-packages/wagtail/contrib/simple_translation/models.pyMeta   s   
r   N)r   r	   r
   __doc__r   r   r   r   r   r   	   s   r   after_create_pagec                 C   s@   t tddr<tjj|jdD ]}||s|j|ddd qdS )a  Creates page aliases in other locales when a page is created.

    Whenever a page is created under a specific locale, this signal handler
    creates an alias page for that page under the other locales.

    e.g. When an editor creates the page "blog/my-blog-post" under the English
    tree, this signal handler creates an alias of that page called
    "blog/my-blog-post" under the other locales' trees.
    Z'WAGTAILSIMPLETRANSLATION_SYNC_PAGE_TREEF)pkT)Zcopy_parentsaliasN)getattrr   r   ZobjectsexcludeZ	locale_idZhas_translationZcopy_for_translation)requestpagelocaler   r   r   r      s    
N)Zdjango.confr   Zdjango.db.modelsr   Zdjango.utils.translationr   r   Zwagtailr   Zwagtail.modelsr   r   registerr   r   r   r   r   <module>   s   