
    Nwgg                        d dl Z d dl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 d dlmZ d d	lmZmZ d d
lmZmZ ddlmZ ddlmZmZmZ ej:                  Z G d dej<                        Z G d dej<                        Z  G d dej<                        Z! G d dej<                        Z" G d dej<                        Z# G d dej<                        Z$ G d dejJ                        Z& G d dej<                        Z' G d dejJ                        Z( G d  d!ej<                        Z) G d" d#ej<                        Z* G d$ d%ej<                        Z+ G d& d'ej<                        Z, G d( d)ej<                        Z- G d* d+ej<                        Z. G d, d-ej<                        Z/ G d. d/e      Z0 G d0 d1e      Z1 G d2 d3ej<                        Z2 G d4 d5e      Z3 G d6 d7ej<                        Z4 G d8 d9ej<                        Z5 G d: d;ej<                        Z6 G d< d=e6      Z7 G d> d?e6      Z8 G d@ dAej<                        Z9 G dB dCej                        Z: G dD dEej<                        Z; G dF dGejx                        Z= G dH dIej<                        Z> G dJ dKej<                        Z? G dL dMej<                        Z@ G dN dOej<                        ZA eeA        G dP dQej<                        ZB G dR dSe      ZC eeBeCT        G dU dVej<                        ZD G dW dXeD      ZE G dY dZej<                        ZF G d[ d\ej<                        ZG eHed]d^        G d_ d`ej<                        ZI eJed]        G da dbej<                        ZK G dc ddeK      ZL G de dfeK      ZM G dg dhe      ZN G di djej<                        ZO G dk dlej<                        ZP G dm dnej<                        ZQ G do dpeQ      ZR G dq drej<                        ZS G ds dtej<                        ZT G du dvej<                        ZU G dw dxeU      ZV G dy dzeV      ZW G d{ d|ej<                        ZX G d} d~eX      ZY G d deX      ZZ eeZeXg        G d dej<                        Z[ G d dej<                        Z\ eedd        G d dej<                        Z] G d dej<                        Z^ ee^dd        G d dej<                        Z_ G d dej<                        Z` G d dej<                        Za G d dej<                        Zb G d dej<                        Zc G d dej<                        Zd G d dej<                        Ze G d dej<                        Zf G d dej<                        Zg G d dej<                        Zh G d dej<                        Zi G d dej<                        Zj G d dej<                        Zk G d dej<                        Zl G d dej<                        Zm eemd        G d dej<                        Zn G d dej<                        Zo G d dej<                        Zp G d dej<                        Zq G d dej<                        Zr G d dej<                        Zs G d dej<                        Zt G d dej<                        Zu G d dej<                        Zv G d de      Zw G d de      Zx G dĄ der      Zy G dƄ deu      Zz G dȄ derev      Z{ G dʄ der      Z| G d̄ de|      Z} G d΄ der      Z~ G dЄ de~      Z G d҄ der      Z G dԄ dej<                        Z G dք de      Z G d؄ dej<                        Z G dڄ dej<                        Zd܄ Z G d݄ dej<                        Z eeee߫       d Z G d dej<                        Z eeee߫        G d dej<                        Z G d dej<                        Z ee ej                  ej                                eHedd^        G d dej<                        Z eJed        eHedd^        G d dej<                        Z eJed        G d dej<                        Z G d dej<                        Z G d dej<                        Z G d dej<                        Z G d dej<                        Z G d dej<                        Z G d de      Z G d de      Z G d d e      Z G d dej<                        Z eed        G d dej<                        Z G d dej<                        Z G d	 d
ej<                        Z G d dej<                        Z G d dej<                        Z G d dej<                        Z G d dej<                        Z G d dej<                        Z G d dej<                        Z G d dej<                        Z G d dej<                        Z G d dej<                        Z G d dej<                        Zy(      N)apps)settings)models)CASCADE)
ForeignKey)reverse)register)HistoricalQuerySetHistoryManager)HistoricalRecordsHistoricForeignKey   )
CustomUser)AbstractExternalAbstractExternal2AbstractExternal3c                   j    e Zd Z ej                  d      Z ej                  d      Z e       Z	d Z
y)Poll   
max_lengthdate publishedc                 4    t        dd| j                  i      S Nzpoll-detailpkkwargsr   r   selfs    R/var/www/horilla/myenv/lib/python3.12/site-packages/simple_history/tests/models.pyget_absolute_urlzPoll.get_absolute_url       }dDGG_==    N)__name__
__module____qualname__r   	CharFieldquestionDateTimeFieldpub_dater   historyr"    r$   r!   r   r      s4    v3/H#v##$45H!G>r$   r   c                       e Zd Z ej                  d      Z ej                  d      Z ej                  dd      Z e	       Z
y)PollWithNonEditableFieldr   r   r   TF)auto_noweditableN)r%   r&   r'   r   r(   r)   r*   r+   modifiedr   r,   r-   r$   r!   r/   r/      sC    v3/H#v##$45H#v##TEBH!Gr$   r/   c                   f    e Zd Z ej                  dd      Z ej                  d      Z e       Z	y)PollWithUniqueQuestionr   Tr   uniquer   N)
r%   r&   r'   r   r(   r)   r*   r+   r   r,   r-   r$   r!   r4   r4   '   s1    v3t<H#v##$45H!Gr$   r4   c                       e Zd Z ej                  d      Z ej                  d      Z ej                  d      Z	 e
dg      Zy)	PollWithExcludeFieldsr   r   r   Tnullr+   excluded_fieldsN)r%   r&   r'   r   r(   r)   r*   r+   	TextFieldplacer   r,   r-   r$   r!   r8   r8   .   sE    v3/H#v##$45HF$'E=Gr$   r8   c                   $   e Zd Z ej                  d      Z ej                  d      Z ej                   e	j                  ddd            Z ej                  d      Z ej                  d	      Z ej                         Z eg d
      Zy)"PollWithExcludedFieldsWithDefaultsr   r   r   i     defaultTr9   r   )r+   expiration_timer>   min_questionsmax_questionsr;   N)r%   r&   r'   r   r(   r)   r*   r+   	DateFielddatetimedaterD   r=   r>   PositiveIntegerFieldrE   rF   r   r,   r-   r$   r!   r@   r@   6   s    v3/H#v##$45H&f&&}x}}T2r/JKOF$'E/F//:M/F//1M
Gr$   r@   c                       e Zd Z ej                  d      Z ej                  d      Z ej                  dej                        Z
 edg      Zy)	PollWithExcludedFKFieldr   r   r   Place	on_deleter>   r;   N)r%   r&   r'   r   r(   r)   r*   r+   r   r   r>   r   r,   r-   r$   r!   rL   rL   I   sK    v3/H#v##$45HFg@E	:Gr$   rL   c                        e Zd Z fdZ xZS )AlternativePollManagerc                 @    t         |          j                  d      S )Nr   )idsuperget_querysetexcluder    	__class__s    r!   rV   z#AlternativePollManager.get_querysetR   s    w#%---33r$   r%   r&   r'   rV   __classcell__rY   s   @r!   rQ   rQ   Q   s    4 4r$   rQ   c                       e Zd Z e       Z ej                         Z ej                  d      Z	 ej                  d      Z e       Zy)PollWithAlternativeManagerr   r   r   N)r%   r&   r'   rQ   some_objectsr   Managerall_objectsr(   r)   r*   r+   r   r,   r-   r$   r!   r^   r^   V   sE    )+L &.."Kv3/H#v##$45H!Gr$   r^   c                        e Zd Z fdZ xZS )CustomPollManagerc                 @    t         |          j                  d      S )NT)hiddenrT   rX   s    r!   rV   zCustomPollManager.get_queryseta   s    w#%--T-::r$   rZ   r\   s   @r!   rc   rc   `   s    ; ;r$   rc   c                       e Zd Z e       Z ej                         Z ej                  d      Z	 ej                  d      Z ej                  d      Z e       Zy)PollWithCustomManagerr   r   r   FrB   N)r%   r&   r'   rc   r_   r   r`   ra   r(   r)   r*   r+   BooleanFieldre   r   r,   r-   r$   r!   rg   rg   e   sW    $&L &.."Kv3/H#v##$45H V  /F!Gr$   rg   c                   B    e Zd Z ej                         Z G d d      Zy)IPAddressHistoricalModelc                       e Zd ZdZy)IPAddressHistoricalModel.MetaTNr%   r&   r'   abstractr-   r$   r!   Metarl   s       r$   ro   N)r%   r&   r'   r   GenericIPAddressField
ip_addressro   r-   r$   r!   rj   rj   p   s    ---/J r$   rj   c                   p    e Zd Z ej                  d      Z ej                  d      Z ee	g      Z
d Zy)PollWithHistoricalIPAddressr   r   r   basesc                 4    t        dd| j                  i      S r   r   r   s    r!   r"   z,PollWithHistoricalIPAddress.get_absolute_url}   r#   r$   N)r%   r&   r'   r   r(   r)   r*   r+   r   rj   r,   r"   r-   r$   r!   rt   rt   w   s:    v3/H#v##$45H'?&@AG>r$   rt   c                   J    e Zd Z ej                  ddd      Z G d d      Zy)SessionsHistoricalModelr   TN)r   r:   rC   c                       e Zd ZdZy)SessionsHistoricalModel.MetaTNrm   r-   r$   r!   ro   r{      rp   r$   ro   )r%   r&   r'   r   r(   sessionro   r-   r$   r!   ry   ry      s"    f#D$GG r$   ry   c                   F    e Zd Z ej                  d      Z eeg      Zy)PollWithHistoricalSessionAttrr   r   ru   N)	r%   r&   r'   r   r(   r)   r   ry   r,   r-   r$   r!   r~   r~      s"    v3/H'>&?@Gr$   r~   c                       e Zd Z ej                  d      Z ej                  d      Z ej                  d      Z	 e
e	g      Zy)PollWithManyToManyr   r   r   rM   
m2m_fieldsN)r%   r&   r'   r   r(   r)   r*   r+   ManyToManyFieldplacesr   r,   r-   r$   r!   r   r      sE    v3/H#v##$45H#V##G,FF84Gr$   r   c                       e Zd Z ej                  d      Z ej                  d      Z ej                  d      Z	 e
e	g ej                  ej                              Zy)!PollWithManyToManyCustomHistoryIDr   r   r   rM   rB   )r   history_id_fieldN)r%   r&   r'   r   r(   r)   r*   r+   r   r   r   	UUIDFielduuiduuid4r,   r-   r$   r!   r   r      s\    v3/H#v##$45H#V##G,F8.>f.>.>tzz.RGr$   r   c                       e Zd Zd Zy)PollQuerySetc                 &    | j                  d      S )Nz	Question )question__startswithfilterr   s    r!   	questionszPollQuerySet.questions   s    {{{<<r$   N)r%   r&   r'   r   r-   r$   r!   r   r      s    =r$   r   c                       e Zd Zd Zy)PollManagerc                 &    | j                  d      S )N   )id__lter   r   s    r!   low_idszPollManager.low_ids   s    {{1{%%r$   N)r%   r&   r'   r   r-   r$   r!   r   r      s    &r$   r   c                   j    e Zd Z ej                  d      Z ej                  d      Z ee	e
      Zy)PollWithQuerySetCustomizationsr   r   r   )history_managerhistorical_querysetN)r%   r&   r'   r   r(   r)   r*   r+   r   r   r   r,   r-   r$   r!   r   r      s6    v3/H#v##$45H#Gr$   r   c                        e Zd Z fdZ xZS )"HistoricalRecordsWithExtraFieldM2Mc                 :    t         |   |||      }d }||d<   |S )Nc                 .    | j                   j                  S N)rY   r%   r   s    r!   get_class_namezOHistoricalRecordsWithExtraFieldM2M.get_extra_fields_m2m.<locals>.get_class_name   s    >>***r$   r   )rU   get_extra_fields_m2m)r    modelthrough_modelfieldsextra_fieldsr   rY   s         r!   r   z7HistoricalRecordsWithExtraFieldM2M.get_extra_fields_m2m   s.    w3E=&Q	+ *8%&r$   )r%   r&   r'   r   r[   r\   s   @r!   r   r      s     r$   r   c                       e Zd Z ej                  d      Z ej                  d      Z ej                  d      Z	 e
e	geg      Zy)PollWithManyToManyWithIPAddressr   r   r   rM   )r   	m2m_basesN)r%   r&   r'   r   r(   r)   r*   r+   r   r   r   rj   r,   r-   r$   r!   r   r      sN    v3/H#v##$45H#V##G,F08(@'AGr$   r   c                       e Zd Z ej                  d      Z ej                  d      Z ej                  dd      Z	 ej                  dd      Z
 ej                  d	d
      Z ee	e
eg      Zy)PollWithSeveralManyToManyr   r   r   rM   places_pollrelated_name
Restaurantrestaurants_pollBook
books_pollr   N)r%   r&   r'   r   r(   r)   r*   r+   r   r   restaurantsbooksr   r,   r-   r$   r!   r   r      su    v3/H#v##$45H#V##G-HF(&((DVWK"F""6EEFK+GHGr$   r   c                       e Zd Z ej                  d      Z ej                  d      Z ej                  d      Z	 e
e	gd      Z G d d      Zy	)
PollParentWithManyToManyr   r   r   rM   T)r   inheritc                       e Zd ZdZy)PollParentWithManyToMany.MetaTNrm   r-   r$   r!   ro   r      rp   r$   ro   N)r%   r&   r'   r   r(   r)   r*   r+   r   r   r   r,   ro   r-   r$   r!   r   r      sU    v3/H#v##$45H#V##G,F8G
 r$   r   c                   :    e Zd Z ej                  dd      ZdgZy)PollChildBookWithManyToManyr   books_poll_childr   r   N)r%   r&   r'   r   r   r   _history_m2m_fieldsr-   r$   r!   r   r      s    "F""68JKE")r$   r   c                   :    e Zd Z ej                  dd      ZegZy)!PollChildRestaurantWithManyToManyr   restaurants_poll_childr   N)r%   r&   r'   r   r   r   r   r-   r$   r!   r   r      s$    (&((#;K '-r$   r   c                   D    e Zd Z ej                  d      Z eeg      Zy)PollWithSelfManyToManyr    r   N)r%   r&   r'   r   r   	relationsr   r,   r-   r$   r!   r   r      s     &&&v.II;7Gr$   r   c                   2     e Zd Z fdZ fdZ fdZ xZS )CustomAttrNameForeignKeyc                 R    |j                  dd       | _        t        |   |i | y N	attr_namepopr   rU   __init__r    argsr   rY   s      r!   r   z!CustomAttrNameForeignKey.__init__   '    K6$)&)r$   c                 <    | j                   xs t        | 	         S r   r   rU   get_attnamerX   s    r!   r   z$CustomAttrNameForeignKey.get_attname       ~~6!4!66r$   c                 l    t         |          \  }}}}| j                  r| j                  |d<   ||||fS r   rU   deconstructr   r    namepathr   r   rY   s        r!   r   z$CustomAttrNameForeignKey.deconstruct   =    #(7#6#8 dD&>>"&..F;T4''r$   r%   r&   r'   r   r   r   r[   r\   s   @r!   r   r          *7( (r$   r   c                   D    e Zd Z eeej                  d      Z e       Z	y)ModelWithCustomAttrForeignKeycustom_pollr   N)
r%   r&   r'   r   r   r   r   pollr   r,   r-   r$   r!   r   r      s    #D&..MRD!Gr$   r   c                   2     e Zd Z fdZ fdZ fdZ xZS )CustomAttrNameOneToOneFieldc                 R    |j                  dd       | _        t        |   |i | y r   r   r   s      r!   r   z$CustomAttrNameOneToOneField.__init__  r   r$   c                 <    | j                   xs t        | 	         S r   r   rX   s    r!   r   z'CustomAttrNameOneToOneField.get_attname	  r   r$   c                 l    t         |          \  }}}}| j                  r| j                  |d<   ||||fS r   r   r   s        r!   r   z'CustomAttrNameOneToOneField.deconstruct  r   r$   r   r\   s   @r!   r   r     r   r$   r   c                   N    e Zd Z eeej                  d      Z eddhi      Z	y) ModelWithCustomAttrOneToOneFieldr   r   r   r   )excluded_field_kwargsN)
r%   r&   r'   r   r   r   r   r   r   r,   r-   r$   r!   r   r     s%    &tV^^}UDv}6MNGr$   r   c                       e Zd Z ej                  d      Z ej                         Z e       Z	dZ
ed        Zej                  d        Zy)Temperaturer   r   Nc                     | j                   S r   _Temperature__history_dater   s    r!   _history_datezTemperature._history_date  s    """r$   c                     || _         y r   r   r    values     r!   r   zTemperature._history_date#  s
    #r$   )r%   r&   r'   r   r(   locationIntegerFieldtemperaturer   r,   r   propertyr   setterr-   r$   r!   r   r     s]    v3/H%&%%'K!GN# # $ $r$   r   c                       e Zd Z ej                  d      Z ej                         Z ej                         Z	 e
d      Zed        Zy)
WaterLevelr   r   T)cascade_delete_historyc                     | j                   S r   )rI   r   s    r!   r   zWaterLevel._history_date/  s    yyr$   N)r%   r&   r'   r   r(   watersr   levelr*   rI   r   r,   r   r   r-   r$   r!   r   r   (  sP    V-FF!E6!Dt<G r$   r   c                       e Zd Z ej                  eej                        Z ej                  d      Z	 ej                         Zy)ChoicerN   r   r   N)r%   r&   r'   r   r   r   r   r   r(   choicer   votesr-   r$   r!   r   r   4  s<    6TV^^<DV-FF!Er$   r   c                       e Zd Z ej                  eej                        Z ej                  eej                  d      Z	d Z
y)VoterrN   votersrO   r   c                      y)NzVoter objectr-   r   s    r!   __str__zVoter.__str__A  s    r$   N)r%   r&   r'   r   r   Userr   userr   r   r  r-   r$   r!   r  r  =  s9    6TV^^<DVvhWFr$   r  c                        e Zd Z fdZ xZS )HistoricalRecordsVerbosec                 8    d }t         |   ||      }||d<   |S )Nc                 d    dj                  | j                  | j                  | j                        S )Nz{} changed by {} as of {})formathistory_objecthistory_userhistory_dater   s    r!   verbose_strz>HistoricalRecordsVerbose.get_extra_fields.<locals>.verbose_strG  s0    .55##!!!! r$   r  )rU   get_extra_fields)r    r   r   r  r   rY   s        r!   r  z)HistoricalRecordsVerbose.get_extra_fieldsF  s+    	 w/v>"-Yr$   )r%   r&   r'   r  r[   r\   s   @r!   r
  r
  E  s    
 
r$   r
  )records_classc                   2    e Zd Z ej                  d      Zy)rM   d   r   Nr%   r&   r'   r   r(   r   r-   r$   r!   rM   rM   V      6s+Dr$   rM   c                   <    e Zd Z ej                         Z e       Zy)r   N)r%   r&   r'   r   r   ratingr   updatesr-   r$   r!   r   r   Z  s     V  "F!Gr$   r   c                   R     e Zd Z ej                  d      Z e       Z fdZ xZ	S )Personr  r   c                 R    t        | d      rt        d      t        |   |i | y )Nskip_history_when_savingzerror while saving)hasattrRuntimeErrorrU   saver   s      r!   r!  zPerson.savee  s+    434344GL$)&)r$   )
r%   r&   r'   r   r(   r   r   r,   r!  r[   r\   s   @r!   r  r  `  s'    6s+D!G* *r$   r  c                   f    e Zd Z ej                  d      Z ej                  d      Z e       Z	y)	FileModelr  r   files	upload_toN
r%   r&   r'   r   r(   title	FileFieldfiler   r,   r-   r$   r!   r#  r#  l  .    F,E6g.D!Gr$   r#  %SIMPLE_HISTORY_FILEFIELD_TO_CHARFIELDTc                   f    e Zd Z ej                  d      Z ej                  d      Z e       Z	y)CharFieldFileModelr  r   r$  r%  Nr'  r-   r$   r!   r.  r.  v  r+  r$   r.  c                   j    e Zd Z ej                  eej                  dd      Z e       Z	e
d        Zy)DocumentTrO   r:   blankc                 N    	 | j                   S # t        j                  $ r Y y w xY wr   )
changed_byr  DoesNotExistr   s    r!   _history_userzDocument._history_user  s)    	??"   		s    $$N)r%   r&   r'   r   r   r  r   r4  r   r,   r   r6  r-   r$   r!   r0  r0    s=    """TJ  !G r$   r0  c                   R    e Zd Z e       Zej                  j                  d        Zy)Paperc                     || _         y r   r4  r   s     r!   r6  zPaper._history_user  s	    r$   N)r%   r&   r'   r   r,   r0  r6  r   r-   r$   r!   r8  r8    s(    !G""  # r$   r8  c                   @    e Zd Z ej                  d      Z e       Zy)RankedDocument2   rB   N)r%   r&   r'   r   r   rankr   r,   r-   r$   r!   r<  r<    s    6r*D!Gr$   r<  c                   .    e Zd Z ej                         Zy)ProfileN)r%   r&   r'   r   rG   date_of_birthr-   r$   r!   r@  r@    s    $F$$&Mr$   r@  c                   H    e Zd Z ej                  eej                        Zy)AdminProfilerN   N)r%   r&   r'   r   r   r@  r   profiler-   r$   r!   rC  rC    s    f6>>BGr$   rC  c                   X    e Zd Z ej                  dej
                  d      Z e       Zy)StateLibraryTrO   r:   N)	r%   r&   r'   r   r   r   libraryr   r,   r-   r$   r!   rF  rF    s$    f	V^^$OG!Gr$   rF  c                   H    e Zd Z ej                  dd      Z edd      Zy)r      T)r   primary_keyz
dead treeszdead trees plural)verbose_nameverbose_name_pluralN)r%   r&   r'   r   r(   isbnr   r,   r-   r$   r!   r   r     s&    6rt<D!7JGr$   r   c                   .    e Zd Z ej                         Zy)HardbackBookN)r%   r&   r'   r   
FloatFieldpricer-   r$   r!   rQ  rQ    s    FEr$   rQ  c                   H    e Zd Z ej                  eej                        Zy)BookcaserN   N)r%   r&   r'   r   r   rQ  r   r   r-   r$   r!   rU  rU    s    FlfnnEEr$   rU  c                   l    e Zd Z ej                  eej                  d      Z e       Z	 G d d      Z
y)rG  TrH  c                       e Zd ZdZdZy)Library.Metazquiet pleasezquiet please pluralNr%   r&   r'   rM  rN  r-   r$   r!   ro   rX    s    %3r$   ro   N)r%   r&   r'   r   r   r   r   bookr   r,   ro   r-   r$   r!   rG  rG    s.    6TV^^$GD!G4 4r$   rG  c                       e Zd Zy)	BaseModelNr%   r&   r'   r-   r$   r!   r\  r\        r$   r\  c                       e Zd Zy)FirstLevelInheritedModelNr]  r-   r$   r!   r`  r`    r^  r$   r`  c                       e Zd Zy)SecondLevelInheritedModelNr]  r-   r$   r!   rb  rb    r^  r$   rb  c                        e Zd Z G d d      Zy)AbstractBasec                       e Zd ZdZy)AbstractBase.MetaTNrm   r-   r$   r!   ro   rf    rp   r$   ro   Nr%   r&   r'   ro   r-   r$   r!   rd  rd         r$   rd  c                        e Zd Z eeg      Zy)ConcreteAttrru   N)r%   r&   r'   r   rd  r,   r-   r$   r!   rj  rj    s    |n5Gr$   rj  c                       e Zd Zy)ConcreteUtilNr]  r-   r$   r!   rl  rl    r^  r$   rl  ru   c                   H    e Zd Z ej                  eej                        Zy)MultiOneToOnerN   N)r%   r&   r'   r   r   rb  r   fkr-   r$   r!   rn  rn    s    			4	OBr$   rn  c                   X    e Zd Z ej                  dej
                  d      Z e       Zy)SelfFKr    TrH  N)	r%   r&   r'   r   r   r   ro  r   r,   r-   r$   r!   rq  rq    s$    			6V^^$	GB!Gr$   rq  zsimple_history.tests	histories)appmanager_namec                   T    e Zd Z ej                  d      Z e       Z G d d      Zy)ExternalModelWithAppLabelr  r   c                       e Zd ZdZy)ExternalModelWithAppLabel.MetaexternalNr%   r&   r'   	app_labelr-   r$   r!   ro   rx    s    	r$   ro   N	r%   r&   r'   r   r(   r   r   r,   ro   r-   r$   r!   rv  rv    s&    6s+D!G r$   rv  c                   2    e Zd Z ej                  d      Zy)"ExternalModelSpecifiedWithAppParamr  r   Nr  r-   r$   r!   r~  r~    r  r$   r~  zsimple_history.tests.externalc                   T    e Zd Z ej                  d      Z e       Z G d d      Zy)UnicodeVerboseNamer  r   c                       e Zd ZdZy)UnicodeVerboseName.Meta   國N)r%   r&   r'   rM  r-   r$   r!   ro   r    s    r$   ro   Nr|  r-   r$   r!   r  r    s&    6s+D!G   r$   r  c                   T    e Zd Z ej                  d      Z e       Z G d d      Zy)UnicodeVerboseNamePluralr  r   c                       e Zd ZdZy)UnicodeVerboseNamePlural.Metar  N)r%   r&   r'   rN  r-   r$   r!   ro   r  	  s    &r$   ro   Nr|  r-   r$   r!   r  r    s&    6s+D!G' 'r$   r  c                   V    e Zd Z ej                  eej                        Z e       Z	y)CustomFKErrorrN   N)
r%   r&   r'   r   r   rb  r   ro  r   r,   r-   r$   r!   r  r    s#    			4	OB!Gr$   r  c                   \    e Zd ZdZ ej
                  d      Z ej
                  d      Zy)Seriesz+A series of works, like a trilogy of books.r  r   N)r%   r&   r'   __doc__r   r(   r   authorr-   r$   r!   r  r    s)    56s+DV-Fr$   r  c                       e Zd Z ej                  dej
                  d      Z ej                  d      Z e	       Z
 G d d      Zy)	
SeriesWorkr  worksr  r  r   c                       e Zd ZdZy)SeriesWork.MetaseriesN)r%   r&   r'   order_with_respect_tor-   r$   r!   ro   r    s     (r$   ro   N)r%   r&   r'   r   r   r   r  r(   r(  r   r,   ro   r-   r$   r!   r  r    sA    Vx6>>PWXFF,E!G) )r$   r  c                   X    e Zd Z ej                  eej                  d      Z e       Z	y)PollInfoT)rO   rL  N)
r%   r&   r'   r   OneToOneFieldr   r   r   r   r,   r-   r$   r!   r  r  "  s$    6DQD!Gr$   r  c                       e Zd Zy)UserAccessorDefaultNr]  r-   r$   r!   r  r  '  r^  r$   r  c                       e Zd Zy)UserAccessorOverrideNr]  r-   r$   r!   r  r  +  r^  r$   r  c                   X    e Zd Z ej                  d dej
                        Z e       Zy)EmployeeT)r:   rO   N)	r%   r&   r'   r   r  r   managerr   r,   r-   r$   r!   r  r  /  s$    "f"":DFNNSG!Gr$   r  c                   4    e Zd Z ej                  dd      Zy)CountryrK  Tr5   N)r%   r&   r'   r   r(   coder-   r$   r!   r  r  4      6r$7Dr$   r  c                   X    e Zd Z ej                  eej                  d      Z e       Z	y)Provincer  )rO   to_fieldN
r%   r&   r'   r   r   r  r   countryr   r,   r-   r$   r!   r  r  8  s$    f6>>FSG!Gr$   r  c                   X    e Zd Z ej                  eej                  d      Z e       Z	y)CitycountryCode)rO   	db_columnNr  r-   r$   r!   r  r  =  s)    f6>>]G  !Gr$   r  c                   Z    e Zd Z ej                  d      Z e       Zd Z G d d      Z	y)Planet   r   c                     | j                   S r   )starr   s    r!   r  zPlanet.__str__H  s    yyr$   c                       e Zd ZdZdZy)Planet.Metar  PlanetsNrY  r-   r$   r!   ro   r  K  s    'r$   ro   N)
r%   r&   r'   r   r(   r  r   r,   r  ro   r-   r$   r!   r  r  D  s+    6r*D!G( (r$   r  c                   l    e Zd Z ej                  d      Z ej                  dd      Z ed      Z	y)	Contactr  r      Tr5   contacts_history
table_nameN)
r%   r&   r'   r   r(   r   
EmailFieldemailr   r,   r-   r$   r!   r  r  P  s3    6r*DFT:E+=>Gr$   r  c                   Z    e Zd Z ej                  d      Z ej                  dd      Zy)ContactRegisterr  r   r  Tr5   N)r%   r&   r'   r   r(   r   r  r  r-   r$   r!   r  r  V  s(    6r*DFT:Er$   r  contacts_register_historyr  c                   D    e Zd Z ej                  d      Z ed      Zy)ModelWithHistoryInDifferentAppr  r   ry  )rs  Nr%   r&   r'   r   r(   r   r   r,   r-   r$   r!   r  r  ^  s    6r*DJ/Gr$   r  c                   @    e Zd Z ej                  d      Z e       Zy)ModelWithHistoryInDifferentDbr  r   Nr  r-   r$   r!   r  r  c  s    6r*D!Gr$   r  c                   D    e Zd Z ej                  d      Z ed      Zy) ModelWithHistoryUsingBaseModelDbr  r   Tuse_base_model_dbNr  r-   r$   r!   r  r  h  s    6r*D$7Gr$   r  c                   \    e Zd Z ej                  eej                  d      Z ed      Z	y)-ModelWithFkToModelWithHistoryUsingBaseModelDbTrH  r  N)
r%   r&   r'   r   r   r  r   ro  r   r,   r-   r$   r!   r  r  m  s+    			(FNN
B  $7Gr$   r  c                   2    e Zd Z ed      Z G d d      Zy)TrackedAbstractBaseATr   c                       e Zd ZdZy)TrackedAbstractBaseA.MetaTNrm   r-   r$   r!   ro   r  ~  rp   r$   ro   Nr%   r&   r'   r   r,   ro   r-   r$   r!   r  r  {  s    -G r$   r  c                   2    e Zd Z ed      Z G d d      Zy)TrackedAbstractBaseBTr  c                       e Zd ZdZy)TrackedAbstractBaseB.MetaTNrm   r-   r$   r!   ro   r    rp   r$   ro   N)r%   r&   r'   r   	history_bro   r-   r$   r!   r  r    s    !$/I r$   r  c                        e Zd Z G d d      Zy)UntrackedAbstractBasec                       e Zd ZdZy)UntrackedAbstractBase.MetaTNrm   r-   r$   r!   ro   r    rp   r$   ro   Nrg  r-   r$   r!   r  r    rh  r$   r  c                       e Zd Z ed      Zy)TrackedConcreteBaseTr  N)r%   r&   r'   r   r,   r-   r$   r!   r  r    s    -Gr$   r  c                       e Zd Zy)UntrackedConcreteBaseNr]  r-   r$   r!   r  r    r^  r$   r  c                   F    e Zd Z ej                  d      Z G d d      Zy)ConcreteExternalr=  r   c                       e Zd ZdZy)ConcreteExternal.MetatestsNrz  r-   r$   r!   ro   r    s    	r$   ro   Nr%   r&   r'   r   r(   r   ro   r-   r$   r!   r  r    s    6r*D r$   r  c                   F    e Zd Z ej                  d      Z G d d      Zy)ConcreteExternal2r=  r   c                       e Zd Zy)ConcreteExternal2.MetaNr]  r-   r$   r!   ro   r    s    r$   ro   Nr  r-   r$   r!   r  r    s    6r*D r$   r  c                       e Zd Zy)TrackedWithAbstractBaseNr]  r-   r$   r!   r  r    r^  r$   r  c                       e Zd Zy)TrackedWithConcreteBaseNr]  r-   r$   r!   r  r    r^  r$   r  c                       e Zd Zy)InheritTracking1Nr]  r-   r$   r!   r  r    r^  r$   r  c                       e Zd Zy)BaseInheritTracking2Nr]  r-   r$   r!   r  r    r^  r$   r  c                       e Zd Zy)InheritTracking2Nr]  r-   r$   r!   r  r    r^  r$   r  c                       e Zd Zy)BaseInheritTracking3Nr]  r-   r$   r!   r  r    r^  r$   r  c                       e Zd Zy)InheritTracking3Nr]  r-   r$   r!   r  r    r^  r$   r  c                       e Zd Zy)InheritTracking4Nr]  r-   r$   r!   r  r    r^  r$   r  c                   F    e Zd Z ej                  d      Z edd      Zy)	BasePlacer=  r   Tbase_places_history)r   r  Nr  r-   r$   r!   r  r    s!    6r*D9NOGr$   r  c                   2    e Zd Z ej                  d      Zy)InheritedRestaurantFrB   N)r%   r&   r'   r   rh   serves_hot_dogsr-   r$   r!   r  r    s    )f))%8Or$   r  c                   p    e Zd Z ej                  d      Z ej                  edej                        Z	y)BucketMemberr  r   bucket_member)r   rO   N)
r%   r&   r'   r   r(   r   r  r  r   r  r-   r$   r!   r  r    s1    6r*D6?fnnDr$   r  c                   n    e Zd Z ej                  eej                  dd      Z ee      Z	e
d        Zy)
BucketDataTr1  )
user_modelc                     | j                   S r   r:  r   s    r!   r6  zBucketData._history_user  s    r$   N)r%   r&   r'   r   r   r  SET_NULLr4  r   r,   r   r6  r-   r$   r!   r  r    s?    """d$J  <8G r$   r  c                 :    	 | j                   S # t        $ r Y y w xY wr   )r4  AttributeError)instancer   s     r!   get_bucket_member_changed_byr    s%    """ s    	c                   L    e Zd Z ej                  eej                  dd      Zy)BucketDataRegisterChangedByTr1  N)r%   r&   r'   r   r   r  r  r4  r-   r$   r!   r
  r
    s!    """d$Jr$   r
  )r  get_userc                 N    	 | j                   j                  S # t        $ r Y y w xY wr   )r  r  r  )requestr   s     r!   get_bucket_member_request_userr    s)    ||))) s    	$$c                   8    e Zd Z ej                  d      Zd Zy)BucketDataRegisterRequestUserr  r   c                 4    t        dd| j                  i      S )Nzbucket_data-detailr   r   r   r   s    r!   r"   z.BucketDataRegisterRequestUser.get_absolute_url  s    +T477ODDr$   N)r%   r&   r'   r   r(   datar"   r-   r$   r!   r  r    s    6r*DEr$   r  c                       e Zd Z ej                  dej                  d      Z e ej                  ej                              Z	y)	UUIDModelTFrL  rC   r1   rB   r   N
r%   r&   r'   r   r   r   r   rS   r   r,   r-   r$   r!   r  r    s8    			dDJJ	OB1A1A1A$**1UVGr$   r  c                   J    e Zd Z ej                  dej                  d      Zy)UUIDRegisterModelTFr  N)r%   r&   r'   r   r   r   r   rS   r-   r$   r!   r  r    s    			dDJJ	OBr$   r  rB   r  "SIMPLE_HISTORY_HISTORY_ID_USE_UUIDc                   X    e Zd Z ej                  dej                  d      Z e       Z	y)UUIDDefaultModelTFr  Nr  r-   r$   r!   r  r    s$    			dDJJ	OB!Gr$   r  3SIMPLE_HISTORY_HISTORY_CHANGE_REASON_USE_TEXT_FIELDc                   @    e Zd Z ej                  d      Z e       Zy)!DefaultTextFieldChangeReasonModelr  r   Nr%   r&   r'   r   r(   greetingr   r,   r-   r$   r!   r  r  #      v3/H!Gr$   r  c                   f    e Zd Z ej                  d      Z e ej                  d            Zy)UserTextFieldChangeReasonModelr  r   Tr9   )history_change_reason_fieldN)	r%   r&   r'   r   r(   r!  r   r=   r,   r-   r$   r!   r$  r$  ,  s-    v3/H<LF<L<LRV<WXGr$   r$  c                   @    e Zd Z ej                  d      Z e       Zy)CharFieldChangeReasonModelr  r   Nr   r-   r$   r!   r'  r'  1  r"  r$   r'  c                   @    e Zd Z ej                  d      Z e       Zy)CustomManagerNameModelrK  r   Nr%   r&   r'   r   r(   r   r   logr-   r$   r!   r)  r)  6  s    6r*D

Cr$   r)  c                   F    e Zd Z ej                  dd      Z ed      Zy)OverrideModelNameAsStringrK  Tr5   MyHistoricalCustomNameModelcustom_model_nameNr  r-   r$   r!   r-  r-  @  s!    6r$7D2OPGr$   r-  c                   H    e Zd Z ej                  dd      Z ed       Zy)OverrideModelNameAsCallablerK  Tr5   c                     d|  S NAuditr-   xs    r!   <lambda>z$OverrideModelNameAsCallable.<lambda>G  s    eA3K r$   r/  Nr  r-   r$   r!   r2  r2  E  s!    6r$7D2GHGr$   r2  c                   6    e Zd Z edd       Z G d d      Zy)AbstractModelCallable1Tc                     d|  S r4  r-   r6  s    r!   r8  zAbstractModelCallable1.<lambda>K  s    ERSQT+ r$   )r   r0  c                       e Zd ZdZy)AbstractModelCallable1.MetaTNrm   r-   r$   r!   ro   r=  M  rp   r$   ro   Nr  r-   r$   r!   r:  r:  J  s    @UVG r$   r:  c                   4    e Zd Z ej                  dd      Zy) OverrideModelNameUsingBaseModel1rK  Tr5   Nr  r-   r$   r!   r?  r?  Q  r  r$   r?  c                   4    e Zd Z ej                  dd      Zy)$OverrideModelNameUsingExternalModel1rK  Tr5   Nr  r-   r$   r!   rA  rA  U  r  r$   rA  c                   4    e Zd Z ej                  dd      Zy)$OverrideModelNameUsingExternalModel2rK  Tr5   Nr  r-   r$   r!   rC  rC  Y  r  r$   rC  c                   4    e Zd Z ej                  dd      Zy) OverrideModelNameRegisterMethod1rK  Tr5   Nr  r-   r$   r!   rE  rE  ]  r  r$   rE  "MyOverrideModelNameRegisterMethod1r/  c                   4    e Zd Z ej                  dd      Zy) OverrideModelNameRegisterMethod2rK  Tr5   Nr  r-   r$   r!   rH  rH  g  r  r$   rH  c                       e Zd Z ej                  d ddej
                        Z ej                  dddej
                        Z e       Z	y)ForeignKeyToSelfModelT+)r:   r   rO   r    N)
r%   r&   r'   r   r   r   
fk_to_selffk_to_self_using_strr   r,   r-   r$   r!   rJ  rJ  k  sM    """dJ -6,,Tv~~  !Gr$   rJ  c                   D    e Zd Z ej                  d      Z ed      Zy)Street   r   r,   r   Nr*  r-   r$   r!   rO  rO  u  s    6s+D

3Cr$   rO  c                   4    e Zd Z ej                  dd      Zy)ManyToManyModelOtherrK  Tr5   Nr  r-   r$   r!   rR  rR  z  r  r$   rR  c                   f    e Zd Z ej                  dd      Z ej                  e      Z e	       Z
y)BulkCreateManyToManyModelrK  Tr5   Nr%   r&   r'   r   r(   r   r   rR  otherr   r,   r-   r$   r!   rT  rT  ~  s1    6r$7D"F""#78E!Gr$   rT  c                   l    e Zd Z ej                  dd      Z ej                  e      Z e	dg      Z
y)ModelWithExcludedManyToManyrK  Tr5   rV  r;   NrU  r-   r$   r!   rX  rX    s5    6r$7D"F""#78E	:Gr$   rX  c                   r    e Zd Z ej                  ddd      Z ej                  ddd      Z ed      Zy)ModelWithSingleNoDBIndexUniquerK  T)r   r6   db_indexr   no_db_indexN)	r%   r&   r'   r   r(   r   name_keeps_indexr   r,   r-   r$   r!   rZ  rZ    s9    6r$FD'v''2dTRF3Gr$   rZ  c                       e Zd Z ej                  dd      Z ej                  dd      Z ej                  dej                  dd      Z	 ej                  dej                  dd      Z
 eg d      Zy	)
ModelWithMultipleNoDBIndexrK  T)r   r[  rG  rK  )rO   r:   r   )r   ro  rV  r\  N)r%   r&   r'   r   r(   r   r^  r   r   ro  fk_keeps_indexr   r,   r-   r$   r!   r`  r`    sx    6rD9D'v''2E			V^^$S
B 'V&&V^^$SN  ,CDGr$   r`  c                   4    e Zd Z ej                  dd      Zy)TestOrganizationrK  Tr5   Nr  r-   r$   r!   rc  rc    r  r$   rc  c                   B    e Zd Z ej                  dd      Z e       Zy)TestOrganizationWithHistoryrK  Tr5   Nr  r-   r$   r!   re  re    s    6r$7D!Gr$   re  c                   N    e Zd ZdZ ej
                  dd      Z eee	d      Z
y)%TestParticipantToHistoricOrganizationz
    Non-historic table foreign key to historic table.

    In this case it should simply behave like ForeignKey because
    the origin model (this one) cannot be historic, so foreign key
    lookups are always "current".
    rK  Tr5   participantsr  N)r%   r&   r'   r  r   r(   r   r   re  r   organizationr-   r$   r!   rg  rg    s.     6r$7D%#w^Lr$   rg  c                   \    e Zd ZdZ ej
                  dd      Z eee	d      Z
 e       Zy)%TestHistoricParticipantToOrganizationz
    Historic table foreign key to non-historic table.

    In this case it should simply behave like ForeignKey because
    the origin model (this one) can be historic but the target model
    is not, so foreign key lookups are always "current".
    rK  Tr5   rh  r  N)r%   r&   r'   r  r   r(   r   r   rc  r   ri  r   r,   r-   r$   r!   rk  rk    s8     6r$7D%G.L  !Gr$   rk  c                   \    e Zd ZdZ ej
                  dd      Z eee	d      Z
 e       Zy),TestHistoricParticipanToHistoricOrganizationa  
    Historic table foreign key to historic table.

    In this case as_of queries on the origin model (this one)
    or on the target model (the other one) will traverse the
    foreign key relationship honoring the timepoint of the
    original query.  This only happens when both tables involved
    are historic.

    NOTE: related_name has to be different than the one used in
          TestParticipantToHistoricOrganization as they are
          sharing the same target table.
    rK  Tr5   historic_participantsr  N)r%   r&   r'   r  r   r(   r   r   re  r   ri  r   r,   r-   r$   r!   rm  rm    s:     6r$7D%#,L
  !Gr$   rm  )rH   r   django.appsr   django.confr   	django.dbr   django.db.models.deletionr   django.db.models.fields.relatedr   django.urlsr   simple_historyr	   simple_history.managerr
   r   simple_history.modelsr   r   custom_user.modelsr   r  external.modelsr   r   r   	get_modelModelr   r/   r4   r8   r@   rL   r`   rQ   r^   rc   rg   rj   rt   ry   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r   r   r   r   r   r  r
  rM   r   r  r#  setattrr.  delattrr0  r8  r<  r@  rC  rF  r   rQ  rU  rG  r\  r`  rb  rd  rj  rl  rn  rq  rv  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r
  r  r  r  r  r   r   r  r  r$  r'  r)  r-  r2  r:  r?  rA  rC  rE  rH  rJ  rO  rR  rT  rX  rZ  r`  rc  re  rg  rk  rm  r-   r$   r!   <module>r~     s         - 6  # E G 2 S SNN	>6<< >"v|| ""V\\ ">FLL > &;fll ;4V^^ 4
" "; ;
"FLL "v|| >&,, >fll AFLL A
5 5 =% =
&. &
V\\ ): fll I Iv|| $": $
((@ (8V\\ 8
(v00 ("FLL "
(&"6"6 (Ov|| O
$&,, $ 	 	"V\\ " 	 FLL 0  	6 7,FLL ," "	*V\\ 	*" " 94 @" " 9 :v||  H  "X "'d 'C6<< C"FLL "
6<<  4  Fv|| F4fll 4	 		y 		 8 	6<< 
6< 6	< 	 	l^ ,PFLL P"V\\ "
 	) D , , 	&'   'v|| '"FLL "
.V\\ .) )"v|| "
	&,, 		6<< 	"v|| "
8fll 8"v|| "
"6<< "	(V\\ 	(?fll ?;fll ;
 	%@ A0V\\ 0
"FLL "
8v|| 8
8FLL 86<< 6<< FLL 
.&,, .	FLL 	' ( 	2 		1 		+-B 		/ 		+ 		/ 		+ 		+ 	P P
9) 96<<  &,,  	)EFLL E 	!+W W
P P 		-=V-=-=djj-Q R 6 ="v|| " 6 7 G N" " G HYV\\ Y
" "
V\\ Q Q
I&,, I
V\\ 8'= 88+< 88+< 88v|| 8 	$:8v|| 8"FLL "4V\\ 4
86<< 8" ";&,, ;4V\\ 4	E 	E8v|| 8"&,, "
FLL "FLL " "6<< "r$   