
    wgU                        d dl mZmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
mZmZmZmZmZmZmZmZ d dlmZmZmZmZmZmZmZmZmZ d dlmZmZm Z m!Z! d dl"m#Z#m$Z$m%Z%m&Z& d d	l'm(Z(m)Z) d d
l*m+Z+ d dl,m-Z- d dl.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;  G d de-          Z< G d de-          Z= G d de-          Z> G d de-          Z? G d de-          Z@ G d de-          ZA G d dee-          ZB G d dee-          ZC G d dee-          ZD G d d ee-          ZE G d! d"ee-          ZF G d# d$ejG                  ZH G d% d&ejG                  ZI G d' d(eI          ZJ G d) d*eI          ZK G d+ d,eI          ZL G d- d.eI          ZM G d/ d0eI          ZN G d1 d2eI          ZO G d3 d4eI          ZP G d5 d6eI          ZQ G d7 d8eI          ZR G d9 d:eeI          ZS G d; d<eeI          ZT G d= d>eeI          ZU G d? d@eI          ZV G dA dBeejG                  ZW G dC dDeejG                  ZXejY        Z                    e%eW           ejY        Z                    e(eX           ejY        Z                    eeK           ejY        Z                    eeJ           ejY        Z                    eeM           ejY        Z                    eeO           ejY        Z                    e!eV           ejY        Z                    e eT           ejY        Z                    eeU           ejY        Z                    eeS           ejY        Z                    e
eL           ejY        Z                    eeN           ejY        Z                    eeR           ejY        Z                    eeP           ejY        Z                    eeQ           ejY        Z                    e&eH           dES )F    )SortableAdminBaseSortableStackedInline)admin)	mark_safe)ProductRepositoryInterface)	ContentBlockCoverFeaturesBlockFooterNavbarQuestionsBlockRegisterBlockSocialMediaBlockStagesBlock)	AdditionalCatalogProductTypeCatalogProductCatalogProductTypeFeatureFooterMenuItemNavMenuItemQuestionSocialMediaButtonStage)AdditionalCatalogBlockCatalogBlockMainPageCatalogBlockPromoCatalog)BlockBlockRelationshipPageTemplate)LandingLandingBlock)get_product_repository)
BaseInline)#AdditionalCatalogCustomStylesInlineCatalogCustomStylesInlineContentCustomStylesInlineCoverCustomStylesInlineFeaturesCustomStylesInlineFooterCustomStylesInline!MainPageCatalogCustomStylesInlineNavbarCustomStylesInlinePromoCatalogCustomStylesInlineQuestionsCustomStylesInlineRegisterCustomStylesInlineSocialCustomStylesInlineStagesCustomStylesInlinec                       e Zd ZeZdS )QuestionInlineN)__name__
__module____qualname__r   model     %/var/www/html/cms/web/blocks/admin.pyr4   r4   >   s        EEEr:   r4   c                       e Zd ZeZdS )NavMenuItemAdminN)r5   r6   r7   r   r8   r9   r:   r;   r=   r=   B   s        EEEr:   r=   c                       e Zd ZeZdS )FooterMenuItemAdminN)r5   r6   r7   r   r8   r9   r:   r;   r?   r?   F   s        EEEr:   r?   c                       e Zd ZeZdS )FeatureInlineN)r5   r6   r7   r   r8   r9   r:   r;   rA   rA   J   s        EEEr:   rA   c                       e Zd ZeZdS )SocialMediaButtonInlineN)r5   r6   r7   r   r8   r9   r:   r;   rC   rC   N   s        EEEr:   rC   c                       e Zd ZeZdS )StageInlineN)r5   r6   r7   r   r8   r9   r:   r;   rE   rE   R           EEEr:   rE   c                       e Zd ZeZdS )PageBlockInlineN)r5   r6   r7   r   r8   r9   r:   r;   rH   rH   V   rF   r:   rH   c                       e Zd ZeZdS )LandingBlockInlineN)r5   r6   r7   r#   r8   r9   r:   r;   rJ   rJ   Z   s        EEEr:   rJ   c                   D     e Zd ZU eZ e            Zeed<   d fd	Z	 xZ
S )CatalogProductInline
repositoryNc                      t                      j        ||fi |}|r4| j                            |j                  |j        j        d         _        |S )Noffer)superget_formsetrM   get_published_offersproduct_type_idformbase_fieldsqueryset)selfrequestobjkwargsformset	__class__s        r;   rQ   z CatalogProductInline.get_formsetb   sW    %%''%gs==f== 	s9=9]9]^a^q9r9rGL$W-6r:   )N)r5   r6   r7   r   r8   r$   rM   r   __annotations__rQ   __classcell__)r\   s   @r;   rL   rL   ^   s^         E-C-C-E-EJ*EEE         r:   rL   c                       e Zd ZeZdS )MainPageCatalogProductInlineN)r5   r6   r7   r   r8   r9   r:   r;   r`   r`   i   s        EEEr:   r`   c                       e Zd ZeZdS )AdditionalCatalogProductInlineN)r5   r6   r7   r   r8   r9   r:   r;   rb   rb   m   s        (EEEr:   rb   c                       e Zd ZddgZdS )TemplateAdminnamefileN)r5   r6   r7   list_displayr9   r:   r;   rd   rd   q   s        F#LLLr:   rd   c                   >    e Zd ZdZg dZdgZdZd Zde_        d Z	dS )	BaseBlockAdminzblocks/change_form.html)re   templateclone_buttonblock_relationblocks/change_list_page.htmlc                 L    t          d|j         d|j        j         d          S )Nz0<button class="copy-button" onclick="cloneBlock(z, 'u!   ')">Копировать</button>)r   idr\   r5   rW   rY   s     r;   rk   zBaseBlockAdmin.clone_button|   sC     H  H  HCMLb  H  H  H
 
 	
r:    c                     |D ]@}|j         j        }t          j                            |                                           A|                                 d S )N)ro   )rl   ro   r   objectsfilterdelete)rW   rX   rV   blockrelation_ids        r;   delete_querysetzBaseBlockAdmin.delete_queryset   s]     	F 	FE.1K%,,,<<CCEEEEr:   N)
r5   r6   r7   change_form_templaterg   excludechange_list_templaterk   short_descriptionrx   r9   r:   r;   ri   ri   u   s[        4777L G9
 
 

 &(L"    r:   ri   c                       e Zd ZeegZdS )NavbarAdminN)r5   r6   r7   r=   r-   inlinesr9   r:   r;   r~   r~      s        !9:GGGr:   r~   c                       e Zd ZeegZdS )FooterAdminN)r5   r6   r7   r?   r+   r   r9   r:   r;   r   r      s        "$<=GGGr:   r   c                       e Zd ZegZdS )ContentAdminN)r5   r6   r7   r(   r   r9   r:   r;   r   r      s        ()GGGr:   r   c                       e Zd ZegZdS )
CoverAdminN)r5   r6   r7   r)   r   r9   r:   r;   r   r      s        &'GGGr:   r   c                       e Zd ZeegZdS )FeaturesBlockAdminN)r5   r6   r7   rA   r*   r   r9   r:   r;   r   r      s        89GGGr:   r   c                       e Zd ZegZdS )RegisterBlockAdminN)r5   r6   r7   r0   r   r9   r:   r;   r   r      s        )*GGGr:   r   c                       e Zd ZeegZdS )SocialMediaBlockAdminN)r5   r6   r7   rC   r1   r   r9   r:   r;   r   r      s        &(@AGGGr:   r   c                       e Zd ZeegZdS )QuestionsBlockAdminN)r5   r6   r7   r4   r/   r   r9   r:   r;   r   r      s        :;GGGr:   r   c                       e Zd ZeegZdS )StagesBlockAdminN)r5   r6   r7   rE   r2   r   r9   r:   r;   r   r      s        45GGGr:   r   c                   *    e Zd ZeegZej        ZdgZdS )CatalogAdminre   N)	r5   r6   r7   rL   r'   r   ri   rz   orderingr9   r:   r;   r   r      s(        #%>?G$GxHHHr:   r   c                   $    e Zd ZeegZej        ZdS )MainPageCatalogBlogAdminN)r5   r6   r7   r`   r,   r   ri   rz   r9   r:   r;   r   r      s!        +-NOG$GGGr:   r   c                   $    e Zd ZeegZej        ZdS )AdditionalCatalogBlogAdminN)r5   r6   r7   rb   r&   r   ri   rz   r9   r:   r;   r   r      s!        -/RSG$GGGr:   r   c                       e Zd ZegZdS )PromoCatalogAdminN)r5   r6   r7   r.   r   r9   r:   r;   r   r      s        -.GGGr:   r   c                   4    e Zd Zg dZdZegZd Zde_        dS )	PageAdmin)urltitlerk   rm   c                 2    t          d|j         d          S )Nz/<button class="copy-button" onclick="clonePage(u    )">Копировать</button>)r   ro   rp   s     r;   rk   zPageAdmin.clone_button   s    s36ssstttr:   rq   N)	r5   r6   r7   rg   r{   rH   r   rk   r|   r9   r:   r;   r   r      sE        333L9Gu u u &(L"""r:   r   c                       e Zd Zg dZegZdS )LandingAdmin)r   logore   N)r5   r6   r7   rg   rJ   r   r9   r:   r;   r   r      s!        ***L!"GGGr:   r   N)[adminsortable2.adminr   r   django.contribr   django.utils.safestringr   domain.products.repositoryr   /infrastructure.persistence.models.blocks.blocksr   r	   r
   r   r   r   r   r   r   :infrastructure.persistence.models.blocks.blocks_componentsr   r   r   r   r   r   r   r   r   6infrastructure.persistence.models.blocks.catalog_blockr   r   r   r   /infrastructure.persistence.models.blocks.commonr   r   r    r!   1infrastructure.persistence.models.blocks.landingsr"   r#   :infrastructure.persistence.repositories.product_repositoryr$   web.common.adminr%   web.styles.adminr&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r4   r=   r?   rA   rC   rE   rH   rJ   rL   r`   rb   
ModelAdminrd   ri   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   siteregisterr9   r:   r;   <module>r      s   I I I I I I I I             - - - - - - A A A A A A
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
                       T S S S S S S S      ( ' ' ' ' '                             "    Z       z       *       J       j       *       +Z       .
       0*       #8*   ) ) ) ) )%:J ) ) )$ $ $ $ $E$ $ $ $    U%   *; ; ; ; ;. ; ; ;> > > > >. > > >* * * * *> * * *( ( ( ( ( ( ( (: : : : : : : :+ + + + + + + +B B B B BN B B B< < < < <. < < <6 6 6 6 6~ 6 6 6    $n   % % % % %0. % % %
% % % % %!2N % % %
/ / / / / / / /	( 	( 	( 	( 	(!5#3 	( 	( 	(# # # # #$e&6 # # # 
  D) $ $ $ 
  G\ * * * 
  FK ( ( ( 
  FK ( ( ( 
  E: & & & 
  M#5 6 6 6 
  L"3 4 4 4 
  (*B C C C 
  *,F G G G 
  L, / / / 
  L, / / / 
  M#5 6 6 6 
  K!1 2 2 2 
  $&; < < < 
  N$7 8 8 8 
  Hm , , , , ,r:   