
    h#                        d dl Z d dlZd dlmZ d dlmZmZmZmZ 	 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 d d	lmZmZmZ d
dlmZ ddlmZmZ ddlmZ ddlmZ ddl m!Z!m"Z" ddl#m$Z$m%Z%m&Z& ddl'm(Z(  G d dejR                  jT                        Z+ G d dejR                  jT                        Z, G d dejR                  jT                        Z- G d dejR                  jT                        Z. G d dejR                  jT                        Z/ G d de,      Z0 G d d e/      Z1 G d! d"ejR                  jT                        Z2 G d# d$ejR                  jT                        Z3 G d% d&e-      Z4 G d' d(e,      Z5 G d) d*e4      Z6 G d+ d,ejR                  jT                        Z7 G d- d.e-      Z8 G d/ d0e,      Z9 G d1 d2e8      Z:e	r G d3 d4ejR                  jT                        Z; G d5 d6ejR                  jT                        Z< G d7 d8ejR                  jT                        Z= G d9 d:e-      Z> G d; d<e,      Z? G d= d>e>      Z@ G d? d@ejR                  jT                        ZAdA ZBdB ZC G dC dDejR                  jT                        ZD G dE dFejR                  jT                        ZE G dG dHejR                  jT                        ZF G dI dJejR                  jT                        ZGy# e
$ r dZ	Y w xY w)K    N)	constants)PagePageContentPageUrlPlaceholder)TreeNode)User)ContentType)Site)Text)FuzzyChoiceFuzzyInteger	FuzzyText   )Version   )BlogContentBlogPost)PollPageContentExtension)TestPageContentExtension)IncorrectBlogContentIncorrectBlogPost)AnswerPollPollContent)	FancyPollc                       e Zd Z ed      Z ej                  d      Z ej                  d      Z ej                  d       Z
 G d d      Zed        Zy	)
UserFactory   length
first_name	last_namec                 r    | j                   j                          d| j                  j                          dS )N.z@example.com)r"   lowerr#   )us    Y/home/dcms/DCMS/lib/python3.12/site-packages/djangocms_versioning/test_utils/factories.py<lambda>zUserFactory.<lambda>"   s/    Q\\'')*!AKK,=,=,?+@M     c                       e Zd ZeZy)UserFactory.MetaN)__name__
__module____qualname__r	   model r*   r(   Metar,   %       r*   r2   c                 H    | j                  |      } |j                  |i |S )z6Override the default ``_create`` with our custom call.)_get_managercreate_user)clsmodel_classargskwargsmanagers        r(   _createzUserFactory._create(   s,     "";/"w""D3F33r*   N)r-   r.   r/   r   usernamefactoryFakerr"   r#   LazyAttributeemailr2   classmethodr<   r1   r*   r(   r   r      s_    #H|,Jk*I!G!!ME  4 4r*   r   c                       e Zd Z ej                  d      Z ej                  d       Z ej                  e	      Z
 G d d      Zy)AbstractVersionFactoryz
content.idc                 T    t         j                  j                  | j                        S N)r
   objectsget_for_modelcontent)os    r(   r)   zAbstractVersionFactory.<lambda>3   s    +%%33AII> r*   c                       e Zd ZdgZdZy)AbstractVersionFactory.MetarI   TN)r-   r.   r/   excludeabstractr1   r*   r(   r2   rL   7   s    +r*   r2   N)r-   r.   r/   r>   SelfAttribute	object_idr@   content_type
SubFactoryr   
created_byr2   r1   r*   r(   rD   rD   0   sG    %%%l3I(7((>L $##K0J r*   rD   c                       e Zd Zed        Zy)AbstractContentFactoryc                     |j                   S rF   _base_managerr7   r8   s     r(   r5   z#AbstractContentFactory._get_manager=       (((r*   N)r-   r.   r/   rB   r5   r1   r*   r(   rU   rU   <   s    ) )r*   rU   c                   2    e Zd Z ed      Z G d d      Zy)PollFactory   r    c                       e Zd ZeZy)PollFactory.MetaN)r-   r.   r/   r   r0   r1   r*   r(   r2   r_   E   r3   r*   r2   Nr-   r.   r/   r   namer2   r1   r*   r(   r\   r\   B   s    AD r*   r\   c                   z    e Zd Z ej                  e      Z eg d      Z e	d      Z
 G d d      Zed        Zy)PollContentFactoryenfrit   r    c                       e Zd ZeZy)PollContentFactory.MetaN)r-   r.   r/   r   r0   r1   r*   r(   r2   rj   N       r*   r2   c                     |j                   S rF   rW   rY   s     r(   r5   zPollContentFactory._get_managerQ   rZ   r*   N)r-   r.   r/   r>   rR   r\   pollr   languager   textr2   rB   r5   r1   r*   r(   rc   rc   I   sG    7k*D-.HBD  ) )r*   rc   c                   D    e Zd Z ej                  e      Z G d d      Zy)PollVersionFactoryc                       e Zd ZeZy)PollVersionFactory.MetaNr-   r.   r/   r   r0   r1   r*   r(   r2   rs   Y       r*   r2   N)r-   r.   r/   r>   rR   rc   rI   r2   r1   r*   r(   rq   rq   V        g  !34G r*   rq   c                   0    e Zd Zej                  d        Zy)PollContentWithVersionFactoryc                 $    |sy t        dd| i| y NrI   r1   )rq   selfcreate	extractedr:   s       r(   versionz%PollContentWithVersionFactory.version^        24262r*   Nr-   r.   r/   r>   post_generationr   r1   r*   r(   rx   rx   ]       3 3r*   rx   c                   j    e Zd Z ej                  e      Z ej                  d       Z G d d      Z	y)AnswerFactoryc                 N    d| j                   j                  j                   d| S )NzPoll z
 - Answer )poll_contentrm   ra   )rJ   ns     r(   r)   zAnswerFactory.<lambda>k   s$    uQ^^00556jD r*   c                       e Zd ZeZy)AnswerFactory.MetaN)r-   r.   r/   r   r0   r1   r*   r(   r2   r   n   s    r*   r2   N)
r-   r.   r/   r>   rR   rc   r   LazyAttributeSequencero   r2   r1   r*   r(   r   r   h   s4    %7%%&89L(7((DD r*   r   c                   2    e Zd Z ed      Z G d d      Zy)BlogPostFactoryr]   r    c                       e Zd ZeZy)BlogPostFactory.MetaN)r-   r.   r/   r   r0   r1   r*   r(   r2   r   u   s    r*   r2   Nr`   r1   r*   r(   r   r   r   s    AD r*   r   c                   j    e Zd Z ej                  e      Z eg d      Z e	d      Z
 G d d      Zy)BlogContentFactoryrd   rh   r    c                       e Zd ZeZy)BlogContentFactory.MetaN)r-   r.   r/   r   r0   r1   r*   r(   r2   r   ~   rk   r*   r2   N)r-   r.   r/   r>   rR   r   blogpostr   rn   r   ro   r2   r1   r*   r(   r   r   y   s3    !w!!/2H-.HBD r*   r   c                   D    e Zd Z ej                  e      Z G d d      Zy)BlogPostVersionFactoryc                       e Zd ZeZy)BlogPostVersionFactory.MetaNrt   r1   r*   r(   r2   r      ru   r*   r2   N)r-   r.   r/   r>   rR   r   rI   r2   r1   r*   r(   r   r      rv   r*   r   c                   0    e Zd Zej                  d        Zy)BlogContentWithVersionFactoryc                 $    |sy t        dd| i| y rz   )r   r{   s       r(   r   z%BlogContentWithVersionFactory.version   s     6t6v6r*   Nr   r1   r*   r(   r   r      s    7 7r*   r   c                   2    e Zd Z ed      Z G d d      Zy)IncorrectBlogPostFactoryr]   r    c                       e Zd ZeZy)IncorrectBlogPostFactory.MetaN)r-   r.   r/   r   r0   r1   r*   r(   r2   r      s    !r*   r2   Nr`   r1   r*   r(   r   r      s    AD" "r*   r   c                   V    e Zd Z ej                  e      Z ed      Z G d d      Z	y)IncorrectBlogContentFactoryrh   r    c                       e Zd ZeZy) IncorrectBlogContentFactory.MetaN)r-   r.   r/   r   r0   r1   r*   r(   r2   r      s    $r*   r2   N)
r-   r.   r/   r>   rR   r   r   r   ro   r2   r1   r*   r(   r   r      s)    !w!!":;HBD% %r*   r   c                   D    e Zd Z ej                  e      Z G d d      Zy)IncorrectBlogPostVersionFactoryc                       e Zd ZeZy)$IncorrectBlogPostVersionFactory.MetaNrt   r1   r*   r(   r2   r      ru   r*   r2   N)r-   r.   r/   r>   rR   r   rI   r2   r1   r*   r(   r   r      s     g  !<=G r*   r   c                   0    e Zd Zej                  d        Zy)&IncorrectBlogContentWithVersionFactoryc                 $    |sy t        dd| i| y rz   )r   r{   s       r(   r   z.IncorrectBlogContentWithVersionFactory.version   s    '???r*   Nr   r1   r*   r(   r   r      s    @ @r*   r   c                       e Zd Zej                  j                  ej                  j                               Z	dZ
 edej                        Z G d d      Zy)TreeNodeFactoryr      r!   charsc                       e Zd ZeZy)TreeNodeFactory.MetaN)r-   r.   r/   r   r0   r1   r*   r(   r2   r      s    Er*   r2   N)r-   r.   r/   r>   fuzzyr   r   rG   allsitedepthr   stringdigitspathr2   r1   r*   r(   r   r      sD    }}(()9)9);< 7	 	r*   r   c                   0    e Zd ZdZdZdZdZ G d d      Zy)PageUrlFactory Fre   c                       e Zd ZeZy)PageUrlFactory.MetaN)r-   r.   r/   r   r0   r1   r*   r(   r2   r      ru   r*   r2   N)r-   r.   r/   slugr   managedrn   r2   r1   r*   r(   r   r      s     DDGH r*   r   c                       e Zd Zer ej
                  e      ZnIej                  j                  e
j                  j                               ZdZ edej"                        Z G d d      Zy)PageFactoryr   r   r   c                       e Zd ZeZy)PageFactory.MetaN)r-   r.   r/   r   r0   r1   r*   r(   r2   r      r3   r*   r2   N)r-   r.   r/   r   r>   rR   r   noder   r   r   rG   r   r   r   r   r   r   r   r2   r1   r*   r(   r   r      sW    !w!!/2}}(()9)9);<7 r*   r   c                   ,   e Zd Z ej                  e      Z eg d      Z e	d      Z
 e	d      Z e	d      Z e	d      Z e	d      Z e	d      Z e	d      Z eddg      Z eddg      Zej(                  ZdZ edd      Z G d	 d
      Zy)PageContentFactoryrd   r   r    TFz	page.htmlr      c                       e Zd ZeZy)PageContentFactory.MetaN)r-   r.   r/   r   r0   r1   r*   r(   r2   r      rk   r*   r2   N)r-   r.   r/   r>   rR   r   pager   rn   r   title
page_title
menu_titlemeta_descriptionredirectrS   
changed_byin_navigation	soft_rootr   VISIBILITY_USERSlimit_visibility_in_menutemplater   xframe_optionsr2   r1   r*   r(   r   r      s    7k*D-.HR E"%J"%J +#H"%J"%Ju.MT5M*I(99H!!Q'N r*   r   c                   D    e Zd Z ej                  e      Z G d d      Zy)PageVersionFactoryc                       e Zd ZeZy)PageVersionFactory.MetaNrt   r1   r*   r(   r2   r      ru   r*   r2   N)r-   r.   r/   r>   rR   r   rI   r2   r1   r*   r(   r   r      rv   r*   r   c                   0    e Zd Zej                  d        Zy)PageContentWithVersionFactoryc                 $    |sy t        dd| i| y rz   )r   r{   s       r(   r   z%PageContentWithVersionFactory.version   r   r*   Nr   r1   r*   r(   r   r      r   r*   r   c                   Z    e Zd Z edd      Z edej                        Z G d d      Z	y)PlaceholderFactoryr      r   r   c                       e Zd ZeZy)PlaceholderFactory.MetaN)r-   r.   r/   r   r0   r1   r*   r(   r2   r     rk   r*   r2   N)
r-   r.   r/   r   default_widthr   r   r   slotr2   r1   r*   r(   r   r      s(     B'MAV]]3D r*   r   c                 ^    | j                   j                  | j                        xs d}|dz   S )zgHelper function to correctly calculate the plugin position.
    Use this in plugin factory classes
    r   r   )placeholderget_last_plugin_positionrn   )pluginoffsets     r(   get_plugin_positionr     s-     88INQFA:r*   c                 p    | j                   j                   | j                   j                  j                  S y)znHelper function to get the language from a plugin's relationships.
    Use this in plugin factory classes
    N)r   sourcern   )r   s    r(   get_plugin_languager     s3       ,!!((111 -r*   c                       e Zd Z ej                  e      Z ej                  e      Z	dZ
 ej                  e      ZdZej                  j                  d      Z G d d      Zy)TextPluginFactoryN
TextPlugin2   r    c                       e Zd ZeZy)TextPluginFactory.MetaN)r-   r.   r/   r   r0   r1   r*   r(   r2   r   !  r3   r*   r2   )r-   r.   r/   r>   r@   r   rn   rR   r   r   parentr   positionplugin_typer   r   bodyr2   r1   r*   r(   r   r     sf    $w$$%89H$'$$%78KF$w$$%89HK==""""-D r*   r   c                   2    e Zd Z ed      Z G d d      Zy)FancyPollFactoryrh   r    c                       e Zd ZeZy)FancyPollFactory.MetaN)r-   r.   r/   r   r0   r1   r*   r(   r2   r   (  s    r*   r2   Nr`   r1   r*   r(   r   r   %  s    BD r*   r   c                   V    e Zd Z ej                  e      Z edd      Z G d d      Z	y)PollTitleExtensionFactoryr   d   c                       e Zd ZeZy)PollTitleExtensionFactory.MetaN)r-   r.   r/   r   r0   r1   r*   r(   r2   r   0      (r*   r2   N)
r-   r.   r/   r>   rR   r   extended_objectr   votesr2   r1   r*   r(   r   r   ,  s+    (g(();<OC E) )r*   r   c                   D    e Zd Z ej                  e      Z G d d      Zy)TestTitleExtensionFactoryc                       e Zd ZeZy)TestTitleExtensionFactory.MetaN)r-   r.   r/   r   r0   r1   r*   r(   r2   r  7  r  r*   r2   N)r-   r.   r/   r>   rR   r   r  r2   r1   r*   r(   r  r  4  s    (g(();<O) )r*   r  )Hr   r>   cmsr   
cms.modelsr   r   r   r   r   ImportErrordjango.contrib.auth.modelsr	   "django.contrib.contenttypes.modelsr
   django.contrib.sites.modelsr   djangocms_text.modelsr   factory.fuzzyr   r   r   modelsr   blogpost.modelsr   r   extended_polls.modelsr   extensions.modelsr   &incorrectly_configured_blogpost.modelsr   r   polls.modelsr   r   r   unversioned_editable_app.modelsr   djangoDjangoModelFactoryr   rD   rU   r\   rc   rq   rx   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r1   r*   r(   <module>r     sc      > ># , : , & > >  2 ; 7 4 3 64'..33 4&	W^^>> 	)W^^>> )'..33 
):: 
)/ 3$6 3GNN55 gnn77 / 3 7$6 7"w~~@@ "%"8 %&< @-H @ '..;; W^^66 	'..33 	/ (/ 3$6 3:: 2	99 	w~~88 ) A A )) A A )W	  Hs   K( (K32K3