
    pg                        d dl mZ d dlmZ d dlmZmZmZ d dlm	Z	m
Z
 d dlmZ d dl ddlmZ d d	lmZ d d
lmZ d dlmZ d dlZ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# d dl$m%Z% d dl&m&Z& d dl'Z'd dl$m(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l0 d dl1Z1d Z2d Z3d Z4 G d de      Z5 G d de      Z6 G d d e      Z7 G d! d"e      Z8 G d# d$e      Z9 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/ d0e      Z? G d1 d2e      Z@ G d3 d4e      ZA G d5 d6e      ZB G d7 d8e      ZC G d9 d:e      ZD G d; d<e      ZE G d= d>e      ZF G d? d@e      ZG G dA dBe      ZH G dC dDe      ZI G dE dFe      ZJ G dG dHe      ZK G dI dJe      ZL G dK dLe      ZM G dM dNe      ZN G dO dPe      ZO G dQ dRe      ZP G dS dTe      ZQ G dU dVe      ZR G dW dXe      ZS G dY dZe      ZT G d[ d\e      ZU G d] d^e      ZV G d_ d`e      ZW G da dbe      ZX G dc dde      ZY G de dfe      ZZ G dg dhe      Z[ G di dje      Z\ G dk dle      Z] G dm dne      Z^ G do dpe      Z_ G dq dre      Z` G ds dte      Za G du dve      Zb G dw dxe      Zc G dy dze      Zd G d{ d|e      Ze G d} d~e      Zf G d de      Zg G d de      Zh G d de      Zi G d de      Zj G d de      Zk G d de      Zl G d de      Zm G d de      Zn G d de      Zo G d de      Zp G d de      Zq G d de      Zr G d de      Zs G d de      Zt G d de      Zu G d de      Zv G d de      Zw G d de      Zx G d de      Zy G d de      Zz G d de      Z{ G d de      Z| G d de      Z} G d de      Z~ G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zd Zd ZdÄ ZdĄ Zdń ZdƄ Zy)    )View)TemplateView)authenticateloginlogout)renderredirect)HttpResponse)*   )forms)messages)mail)render_to_stringN)settings)	Paginator)JsonResponse)login_required)method_decorator)Q)datetime)Count)django_pbkdf2_sha256)HttpResponseRedirect)defaultdictc                     | j                   j                  d      }t        j                  j	                  |      j                         }|rt        d      S d}t        |d      S )Nemailr   truez)This email does not exist in our databaseFsafe)GETgetUserobjectsfilterfirstr
   r   )requesttextpostmessages       </var/www/html/Investors/ModernInvestors/admin_panel/views.py
checkEmailr-   %   sT     $'--/	v	7'	g5	))    c                    | j                   j                  dd      }| j                   j                  d      }t        j                  j                  |      }|j	                  |      dk(  rd}t        |d      S t        d      S )	Nr    passwordr   Fz!Please enter the correct passwordr    r   )r"   r#   r$   r%   check_passwordr   r
   )r(   r)   r1   userr+   s        r,   checkLoginPasswordr4   .   so    #KKOOJ'  t ,!U*/'	g5	))	v	r.   c                     | j                   j                  d      }t        j                  j                  | j                  j
                        }|j                  |      dk(  rd}t        |d      S t        d      S )Nold_passwordr   Fz%Does not match with the old password.r    r   )	r"   r#   r$   r%   r3   r   r2   r   r
   )r(   r6   r3   r+   s       r,   adminCheckPasswordr7   8   se    /  w||'9'9 :%.3'	g5	))	v	r.   c                       e Zd ZdZd Zd Zy)
AdminLogInzadmin-signin.htmlc                 p    |j                   j                  rt        d      S t        || j                        S N/admin-dashboardr3   is_authenticatedr   r   template_nameselfr(   s     r,   r#   zAdminLogIn.getD   .    \\""
1
22	**	++r.   c                    	 t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }t        ||      }|j                  dk(  r!t        j                  |d       t        d      S |j                  r!t        j                  |d       t        d      S |r-t        ||       t        j                  |d       t        d	      S t        j                  |d
       t        d      S t        || j                  d|i      S # t         $ r+}t        j"                  |d       t        d      cY d }~S d }~ww xY w)Nr   r1   )r   r1   Fz/You account has been deactivated by superadmin./admin-loginz+You account has been deleted by superadmin.zLogin successfullyr<   zInvalid email and password.form&Something went wrong.Please try again.zadmin-login)r   AdminSigninFormPOSTis_validcleaned_datar#   r   statusr   errorr	   end_dater   successr   r?   	Exceptionwarning)rA   r(   rE   r   r1   r3   es          r,   r*   zAdminLogIn.postI   s.   "



-4
mmo  $$W-E  $$Z0H%(;D{{e^^GNO^$$}}^^GJK^$$GTw 45()) ^^G:;^$$'$,,vtn==	 "GEF
=
!!"s6   B!D: $,D: .D:   D: !D: :	E. E)#E.)E.N__name__
__module____qualname__r?   r#   r*    r.   r,   r9   r9   B   s    $,
"r.   r9   c                       e Zd ZdZd Zd Zy)AdminForgetPasswordzforgot-password.htmlc                 p    |j                   j                  rt        d      S t        || j                        S r;   r=   r@   s     r,   r#   zAdminForgetPassword.getj   rB   r.   c           	      F   t        j                  |j                        }|j                         rT|j                  j                  d      }t        j                  j                  |      j                         }dj                  t        d      D cg c]6  }t        j                  t        j                  t        j                   z         8 c}      }dt#        |j$                        z   dz   |z   }t#        t&        j(                        |z   }||_        |j-                          d}	t/        dd	|i      }
|
}t&        j0                  }|}t3        j4                  |	|||g|

       t7        j8                  |d       t;        d      S t=        || j>                  d|i      S c c}w )Nr   r   r0      z/forgot-admin//zForgot Passwordz forget_admin_password_email.htmllinkhtml_messagez/A link has been successfully sent to your mail.z/admin-forget-passwordrE   ) r   AdminForgetPasswordFormrH   rI   rJ   r#   r$   r%   r&   r'   joinrangerandomchoicestringascii_lettersdigitsstrr   r   BASE_URLforgot_password_linksaver   EMAIL_HOST_USERr   	send_mailr   rN   r	   r   r?   )rA   r(   rE   r   	admin_objnran_numbaselinkcompletelinksubjectr_   plain_message
from_emailtos                 r,   r*   zAdminForgetPassword.posto   sV   		&	&w||	4$	]]_!!'*5||""5"17799WWSXY[S\]S\afmmF$8$86==$HIS\]^7#ioo"66<wF8h''(83<$,9!>>7"#EP\G]^<=((:2>>'=*rdVGNO
+
,,
$,,vtn
== ^s   ;FNrR   rV   r.   r,   rX   rX   h   s    ',
>r.   rX   c                       e Zd ZdZd Zd Zy)ForgetPasswordVerificationzreset-password.htmlc                    t        | j                  j                        }|j                  d      d   }t        j
                  j                  |      j                         }|j                  dk(  rt        |d      S t        j
                  j                  ||      j                         }|rd}nd}t        || j                  t                     S )	Nr\   r   
LinkExpiryzlink_expire.html)r   rj   TF)rh   r(   pathsplitr$   r%   r&   r'   rj   r   r?   locals)rA   r(   r]   
user_emaillink_expiryrn   valids          r,   r#   zForgetPasswordVerification.get   s    	T\\	$zz#r"*##J#7==?+%%5
+
,,ll!!*T!RXXZ)55	**68	44r.   c                    t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }t        | j                  j                        }|j                  d      d   }t        |       t        j                  j                  |      j                         }|rI|j                  |       d|_        |j#                          t%        j&                  |d       t)        d      S t%        j*                  |d	       t)        d      S t-        || j.                  d
|i      S )Nnew_passwordconfirm_new_passwordr\   r   r{   zPassword changed successfullyrD   zSomething went wrongrE   )r   ForgetVerificationFormrH   rI   rJ   r#   rh   r(   r|   r}   printr$   r%   r&   r'   set_passwordrj   rk   r   rN   r	   rL   r   r?   )rA   r(   rE   r   r   r]   r   user_objs           r,   r*   zForgetPasswordVerification.post   s   		%	%gll	3$	]]_##''7<++//0FG
dll
 4

3#:ll!!*!5;;=8,'$0H!MMOW=>N##NN723N##
$,,vtn
==r.   NrR   rV   r.   r,   rx   rx      s    &5>r.   rx   c                   :    e Zd ZdZ e ed            d        Zy)AdminDashboardzdashboard.htmlrD   	login_urlc                    t         j                  j                  dd      j                         }t         j                  j                  dd      d d }t         j                  j                  dd      j                         }t        j                  j                  d      j                         }t
        j                  j                  d      j                         }t        j                  j                  d      j                         }t        j                  j                  d      j                         }t        j                  j                         }	t         j                  j                  dd      j                  d      }
t        t              }|
D ]%  }|j                  j                  }||xx   dz  cc<   ' g d}t        dd	      D cg c]
  }||dz
      }}t        dd	      D cg c]  }|j!                  |d
       }}d|dg}t         j                  j                  dd      j                         }||d}t#        || j$                  t'                     S c c}w c c}w )Nr   Tis_userend_date__isnull   )r   r   r   -id)JanFebMarAprMayJunJulAugSepOctNovDec   r   Users)namedata)has_subscriptionr   )
categoriesuser_series_data)r$   r%   r&   countBlogsCategoryEventsInvestmentResearchInvestmentEducationContentCustomerSubscriptionallorder_byr   int
start_datemonthrb   r#   r   r?   r~   )rA   r(   total_users	users_objtotal_workerstotal_blogstotal_eventstotal_researchtotal_educationsub_objactive_workerusers_by_monthentryr   month_namesir   user_countsr   total_subscriberscontexts                        r,   r#   zAdminDashboard.get   s   ##a4#HNNP+||""Q$"GK),,%%tQ%GMMO-%%,,d,CIIK+&&&=CCE,%--44d4KQQS..66==t=TZZ\/ ((,,.',,%%tQ%GPPQVW-s#.e!!5%A  e+,1!RL9LqAE"L*938B<@<a##Aq)<+@&<=ll))TUY)Z``b &'
 
**68	44 :@s   I'3I,NrS   rT   rU   r?   r   r   r#   rV   r.   r,   r   r      s#    !>N;<5 =5r.   r   c                   @    e Zd ZdZ e ed            d        Zd Zy)AdminProfilezadmin_profile.htmlrD   r   c                 @    t        || j                  t                     S Nr   r?   r~   r@   s     r,   r#   zAdminProfile.get       	**68	44r.   c                    t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }t        j                  j                  |j                  j                        j                  |||||       |j                  j                  d      rvt        |j                  j                  d            }d	|z   }t        j                  j                  |j                  j                        j                  t        |      
       t        j                   |d       t#        d      S t%        || j&                        S )N
first_name	last_namer   phone_numberusernameid)r   r   r   r   r   avatarr\   r   zUpdate Succesfullyzadmin-profile)r   AdminProfileFormrH   rI   rJ   r#   r$   r%   r&   r3   r   updateFILESuploadTheImagesrh   r   rN   r	   r   r?   )	rA   r(   rE   r   r   r   r   r   fileUrls	            r,   r*   zAdminProfile.post   sa   

 
 
.4
mmo""&&|4J!!%%k2I!!'*E$$((8L  $$Z0HLL7<<??+22jS\ch  wC  NV2  W}}"W]]..x89W[W	\\GLLOO,333w<3HW23O$$'$,,--r.   NrS   rT   rU   r?   r   r   r#   r*   rV   r.   r,   r   r      s(    %>N;<5 =5.r.   r   c                   @    e Zd ZdZ e ed            d        Zd Zy)AdminResetPasswordadmin_reset_password.htmlrD   r   c                 @    t        || j                  t                     S r   r   r@   s     r,   r#   zAdminResetPassword.get   r   r.   c                 &   	 t        j                  |j                        }|j                         r|j                  j	                  d      }t
        j                  j	                  |j                  j                        }|j                  |       |j                          t        |       t        j                  |d       t        d      S t        |dd|i      S # t         $ r+}t        j"                  |d       t        d      cY d }~S d }~ww xY w)	NconfirmPasswordr   z)You have successfully reset your passwordrD   r   rE   rF   admin-dashboard)r   ChangePasswordFormrH   rI   r#   r$   r%   r3   r   r   rk   r   r   infor	   r   rO   rP   )rA   r(   rE   r1   r3   rQ   s         r,   r*   zAdminResetPassword.post   s    &

"
"7<<
04
mmo|| 12H||gll&8&89DhIIK
7OMM'FGN## '6GG	 &GEF
$
%%&s$   C
C C 	D% DDDNr   rV   r.   r,   r   r      s(    ,>N;<5 =5&r.   r   c                   6    e Zd Z e ed            d        Zy)AdminLogoutrD   r   c                 Z    t        |       t        j                  |d       t        d      S )NzLogout SuccesfullyrD   )r   r   rN   r	   r@   s     r,   r#   zAdminLogout.get   s%    /
701	.	!!r.   NrS   rT   rU   r   r   r#   rV   r.   r,   r   r      s    >N;<" ="r.   r   c                   @    e Zd ZdZ e ed            d        Zd Zy)privacyPolicyzprivacy_policy.htmlrD   r   c                     t         j                  j                  d      j                         }t	        || j
                  t                     S )NPrivacy	page_typeContentPagesr%   r&   r'   r   r?   r~   rA   r(   cont_objs      r,   r#   zprivacyPolicy.get
  s;    !!((9(=CCE(	**68	44r.   c                 j   t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }t        j                  j                  d      j                         }|r=t        j                  j                  |j                        j                  ||d       n"t        j                  j                  ||d       t        j                  |d       t        d      S t!        || j"                  t%                     S )	Ntitlecontentr   r   r   r   r   r   Updated Successfullyz/privacy-policyr   content_page_formrH   rI   rJ   r#   r   r%   r&   r'   r   r   creater   rN   r	   r   r?   r~   rA   r(   rE   r   r   r   s         r,   r*   zprivacyPolicy.post  s    		 	 	.$	]]_  )5""9-7



%
%	
%
:
@
@
B4
477+22wYb2ceGiPG34
$
%%
++FH
55r.   Nr   rV   r.   r,   r   r     s(    &>N;<5 =56r.   r   c                   @    e Zd ZdZ e ed            d        Zd Zy)termsAndConditionsz
terms.htmlrD   r   c                     t         j                  j                  d      j                         }t	        || j
                  t                     S )NTermsr   r   r   s      r,   r#   ztermsAndConditions.get!  s;    !!((7(;AAC(	**68	44r.   c                 j   t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }t        j                  j                  d      j                         }|r=t        j                  j                  |j                        j                  ||d       n"t        j                  j                  ||d       t        j                  |d       t        d      S t!        || j"                  t%                     S )	Nr   r   r   r   r   r   r   z/terms-and-conditionsr   r   s         r,   r*   ztermsAndConditions.post&  s    		 	 	.$	]]_  )5""9-7



%
%
%
8
>
>
@4
477+22wY`2aeGgNG34
*
++
++FH
55r.   Nr   rV   r.   r,   r   r     s(    >N;<5 =56r.   r   c                   :    e Zd ZdZ e ed            d        Zy)
faqListingzfaq_listing.htmlrD   r   c                    t         j                  j                  d      j                  d      }t	        |d      }|j
                  j                  d      }|j                  |      }t        || j                  t                     S )NTr   r      page)Faqr%   r&   r   r   r"   r#   get_pager   r?   r~   )rA   r(   data_obj	paginatorpage_numberfaq_objs         r,   r#   zfaqListing.get8  si    [[48AA%H(!$)'+{+'	**68	44r.   Nr   rV   r.   r,   r   r   6  s#    #>N;<5 =5r.   r   c                   @    e Zd ZdZ e ed            d        Zd Zy)addFaqzadd_faq.htmlrD   r   c                 @    t        || j                  t                     S r   r   r@   s     r,   r#   z
addFaq.getD  r   r.   c                    t        j                  |j                        }|j                         rx|j                  j                  d      }|j                  j                  d      }t        j                  j                  ||       t        j                  |d       t        d      S t        || j                  t                     S )Nr   r   r   r   zCreated Successfully/faq-listing)r   r   rH   rI   rJ   r#   r  r%   r   r   rN   r	   r   r?   r~   )rA   r(   rE   r   r   s        r,   r*   zaddFaq.postG  s    		 	 	.$	]]_  )5""9-7;;E'2G34
>
""
++FH
55r.   Nr   rV   r.   r,   r
  r
  B  s(    >N;<5 =5	6r.   r
  c                       e Zd ZdZd Zd Zy)editFaqzedit_faq.htmlc                     t         j                  j                  |d      j                         }t	        || j
                  t                     S NTr   r   )r  r%   r&   r'   r   r?   r~   )rA   r(   r   r  s       r,   r#   zeditFaq.getU  s;    KK"=CCE'	**68	44r.   c                    t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }t        j                  j                  |      j                  ||       t        j                  |d       t        d      S t        || j                  t                     S )Nr   r   r   r  r   r  )r   r   rH   rI   rJ   r#   r  r%   r&   r   r   rN   r	   r   r?   r~   )rA   r(   r   rE   r   r   s         r,   r*   zeditFaq.postY  s    		 	 	.$	]]_  )5""9-7;;##%#@G34
>
""
++FH
55r.   NrR   rV   r.   r,   r  r  S  s     5	6r.   r  c                       e Zd Zd Zy)	deleteFaqc                     t         j                  j                  |      j                  t	        j
                                t        j                  |d       t        d      S )Nr   rM   zFaq Deleted Successfullyr  )	r  r%   r&   r   r   nowr   rN   r	   rA   r(   r   s      r,   r#   zdeleteFaq.gete  sG    ++""HLLN";
767	.	!!r.   NrS   rT   rU   r#   rV   r.   r,   r  r  d  s    "r.   r  c                       e Zd ZdZd Zy)userListingzuser_listing.htmlc                    t         j                  j                  dd      j                  d      }|j                  j                  d      }|rbt         j                  j                  t        |      t        |      z  t        |      z  t        |	      z  dd      j                  d      }|j                  j                  d
      }d}|j                  j                  d      }|r9t         j                  j                  ||dz   |z   gdd      j                  d      }t        |d      }|j                  j                  d      }|j                  |      }	t        || j                  t                     S )Nr   Tr   r   search)phone_number__icontains)first_name__icontains)last_name__icontains)email__icontainsr   z22:44:46.873182+00rM    )start_date__ranger   r   r  r  )r$   r%   r&   r   r"   r#   r   r   r  r   r?   r~   )
rA   r(   r  search_postsearch_starttime
search_endr  r  cust_objs
             r,   r#   zuserListing.getm  sv   \\  d CLLUS()+ll!!!K"HalIm"mno  FQ  oR  #R  ST  fq  Sr  #r  {|  PT!  U  ^  ^  _d  e8.,	${{z**ll!!\:PSCSUYCY4Zlpyz!{  E  E  FK  L8!$)'+,(	**68	44r.   NrS   rT   rU   r?   r#   rV   r.   r,   r  r  k  s    $5r.   r  c                       e Zd ZdZd Zd Zy)editUserzedit_user.htmlc                     t         j                  j                  d      }t        j                  j                  d      }t        j                  j                  |dd      j                         }t        || j                  t                     S )NTr   r   r   r   r   )	JobFunctionsr%   r&   JobLevelr$   r'   r   r?   r~   )rA   r(   r   job_function	job_levelr   s         r,   r#   zeditUser.get  so    %%,,d,C,%%t%<)\\  BqD IOOQ(	**68	44r.   c                    t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }t        j                  j                  |      }|j                  j                  d      }	t        j                  j                  |	      }
t        j                  j                  |d      j                  |||||
	       |j                  j                  d
      rbt        |j                  j                  d
            }d|z   }t        j                  j                  |      j                  t        |             t        j                   |d       t#        d      S t%        || j&                  t)                     S )Nr   r   r   r2  r   r3  r   r   r   )r   r   r   r2  r3  r   r\   r   Updated successfully/user-listing)r   editcustomerformrH   rI   rJ   r#   r0  r%   r1  r$   r&   r   r   r   rh   r   rN   r	   r   r?   r~   )rA   r(   r   rE   r   r   r   r2  job_fun_objr3  job_level_objr   s               r,   r*   zeditUser.post  s   				-$	]]_##J/8  )5##''7<##''7<%%))|)<;  $$[19##''Y'7=<<"q)00HUbn  J  Ub0  cmm!GMM--h78GKGLL2%%S\%:G34
?
##
++FH
55r.   NrR   rV   r.   r,   r-  r-  ~  s    !56r.   r-  c                       e Zd ZdZd Zy)userDetailszuser_details.htmlc                     t         j                  j                  |dd      j                         }t	        || j
                  t                     S )Nr   Tr/  )r$   r%   r&   r'   r   r?   r~   )rA   r(   r   r*  s       r,   r#   zuserDetails.get  s=    \\  BqD IOOQ(	**68	44r.   Nr+  rV   r.   r,   r<  r<    s    $5r.   r<  c                       e Zd Zd Zy)
deleteUserc                     t         j                  j                  |d      j                  t	        j
                                t        j                  |d       t        d      S )Nr   r5  r  zUser Deleted Successfullyr7  )	r$   r%   r&   r   r   r  r   rN   r	   r  s      r,   r#   zdeleteUser.get  sI    r!,33X\\^3L"=>((r.   Nr  rV   r.   r,   r?  r?    s    )r.   r?  c                       e Zd ZdZd Zy)adminNotificationszadmin_notifications.htmlc                     t         j                  j                         j                  d      }t	        || j
                  t                     S )Nr   )AdminNotificationsr%   r   r   r   r?   r~   )rA   r(   
notify_objs      r,   r#   zadminNotifications.get  s8    !))--/88?*	**68	44r.   Nr+  rV   r.   r,   rB  rB    s    +5r.   rB  c                       e Zd Zd Zy)deleteAdminNotificationsc                    	 |j                   dk(  r|j                  j                  d      }|rl|j                  d      D cg c]  }t	        |       }}t
        j                  j                  |      j                          t        j                  |d       nt        j                  |d       t        d      S t        d      S c c}w # t        $ r+}t        j                  |d       t        d	      cY d }~S d }~ww xY w)
Nr"   	delete_id,)pk__inzDeleted Sucessfullyz*At least One notification must be selectedz/admin-notificationsrF   r   )methodr"   r#   r}   r   rD  r%   r&   deleter   rN   rL   r	   rO   rP   )rA   r(   idsr   int_id_listrQ   s         r,   r#   zdeleteAdminNotifications.get  s    	/~~&kkook258YYs^"D^r3r7^K"D&..55[5IPPR$$W-BCNN7+WX 677   677 #E  	/W&NO-..	/s6   ?C CA'C ;
C C 	C? C:4C?:C?Nr  rV   r.   r,   rG  rG    s    /r.   rG  c                       e Zd ZdZd Zy)helpAndSupportListzhelp_support_list.htmlc                    t         j                  j                         j                         }t         j                  j	                  d      j                         }t         j                  j	                  d      j                         }t         j                  j                         }t        |d      }|j                  j                  d      }|j                  |      }t        || j                  t                     S )NT)rK   Fr  r  )HelpSupportr%   r   r   r&   r   r"   r#   r  r   r?   r~   )	rA   r(   totalresolvedpendinghelp_objr  r  sup_objs	            r,   r#   zhelpAndSupportList.get  s    



!
!
#
)
)
+%  '''6<<>(&&&6<<>'  $$&(!$)'+{+'	**68	44r.   Nr+  rV   r.   r,   rQ  rQ    s    )5r.   rQ  c                   :    e Zd ZdZ e ed            d        Zy)viewHelpAndSupportzhelp_support_view.htmlrD   r   c                     t         j                  j                  |      j                         }t	        || j
                  t                     S Nr   rS  r%   r&   r'   r   r?   r~   )rA   r(   r   rX  s       r,   r#   zviewHelpAndSupport.get  s;    &&"&-335'	**68	44r.   Nr   rV   r.   r,   rZ  rZ    s#    )>N;<5 =5r.   rZ  c                   @    e Zd ZdZ e ed            d        Zd Zy)sendReplyHelpSupportzhelp_support_reply.htmlrD   r   c                     t         j                  j                  |      j                         }t	        || j
                  t                     S r\  r]  )rA   r(   r   helps       r,   r#   zsendReplyHelpSupport.get  s;    



$
$
$
+
1
1
3$	**68	44r.   c                    t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }t        d|||d      }|}d}	|}
t        j                  |||	|
g|       t        j                  j                  |      j                  |t        j                  j                         d	
       t        j                   |d       t#        d      S t%        || j&                  t)                     S )Nr   rs   replyzsupport_email.html)
reply_textr   rs   ztesteresfera@gmail.comr^   r   T)rc  
reply_daterK   zsend successfullyz/help-and-support-list)r   sendsupportformrH   rI   rJ   r#   r   r   rm   rS  r%   r&   r   r   r  r   rN   r	   r   r?   r~   )rA   r(   r   rE   r   rs   rc  r_   rt   ru   rv   s              r,   r*   zsendReplyHelpSupport.post  s	   			w||	,$	]]_!!'*5""9-7  )5"#7V[fm9no<=(:2>>'=*rdV$++%XEVEVEZEZE\dh+iG01
+
,,
++FH
55r.   Nr   rV   r.   r,   r_  r_    s(    *>N;<5 =56r.   r_  c                   :    e Zd ZdZ e ed            d        Zy)ratingsFeedbackListzservice_feedback_list.htmlrD   r   c                     t         j                  j                         }t        |d      }|j                  j                  d      }|j                  |      }t        || j                  t                     S Nr  r  )
RatingAndFeedbackr%   r   r   r"   r#   r  r   r?   r~   )rA   r(   r  r  r  service_objs         r,   r#   zratingsFeedbackList.get  s[    &&**,(!$)'+"";/+	**68	44r.   Nr   rV   r.   r,   rh  rh    s#    ->N;<5 =5r.   rh  c                   :    e Zd ZdZ e ed            d        Zy)viewRatingsFeedbackzservice_feedback_view.htmlrD   r   c                     t         j                  j                  |      j                         }t	        || j
                  t                     S r\  )rk  r%   r&   r'   r   r?   r~   )rA   r(   r   rl  s       r,   r#   zviewRatingsFeedback.get  s;    !))00B07==?+	**68	44r.   Nr   rV   r.   r,   rn  rn    s#    ->N;<5 =5r.   rn  c                   :    e Zd ZdZ e ed            d        Zy)subscriptionListzsubscription_listing.htmlrD   r   c                    	 t         j                  j                  d      }|j                  j	                  d      }|r:t         j                  j                  t        |      d      j                  d      }t        |d      }|j                  j	                  d      }|j                  |      }t        || j                  t                     S # t        $ r+}t        j                  |d       t        d	      cY d }~S d }~ww xY w)
NTr   r  )subscription_name__icontainsr   r  r  rF   r   )SubscriptionPlansr%   r&   r"   r#   r   r   r   r  r   r?   r~   rO   r   rP   r	   )rA   r(   
method_objr&  r  r  r  rQ   s           r,   r#   zsubscriptionList.get  s    &!))00$0G:*;"**11!Q\2]qu1v  AF  GJQ'9(;  -8
++FH
55	 &GEF
$
%%&s   CC 	D C?9D?DNr   rV   r.   r,   rq  rq    s#    ,>N;<& =&r.   rq  c                   @    e Zd ZdZ e ed            d        Zd Zy)addSubscriptionPlanzadd_subscription.htmlrD   r   c                 @    t        || j                  t                     S r   r   r@   s     r,   r#   zaddSubscriptionPlan.get  r   r.   c                 n   t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }t        j                  j                  ||||||      }	t        j                  |d       t        d	      S t        || j                  t                     S )
Nsubscription_namesubscription_descriptiondurationpriceunlock_realinvestment_tool)r{  rz  r|  r}  r~  r  zAdded Succesfully/subscription-list)r   subscriptionformrH   rI   rJ   r#   rt  r%   r   r   rN   r	   r   r?   r~   )
rA   r(   rE   rz  r{  r|  r}  r~  r  ru  s
             r,   r*   zaddSubscriptionPlan.post#  s   				-$	]]_((,,-@A"//334NO##J/8  )5""&&}5;&&**+<=?!))00Jb  vG  QY  `e#O 1 E:G01
'
((
++FH
55r.   Nr   rV   r.   r,   rw  rw    s(    (>N;<5 =56r.   rw  c                   @    e Zd ZdZ e ed            d        Zd Zy)editSubscriptionPlanedit_subscription.htmlrD   r   c                     t         j                  j                  |      j                         }t	        || j
                  t                     S r\  )rt  r%   r&   r'   r   r?   r~   )rA   r(   r   ru  s       r,   r#   zeditSubscriptionPlan.get7  s;     ((//2/6<<>*	**68	44r.   c                    	 t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }t        j                  j                  |      j                  |||||      }	t        j                  |d       t        d	      S t        |d
      S # t        $ r+}
t        j                  |d       t        d      cY d }
~
S d }
~
ww xY w)Nrz  r|  r}  r~  r  r   )rz  r|  r}  r~  r  zUpdated Succesfullyr  r  rF   r   )r   r  rH   rI   rJ   r#   rt  r%   r&   r   r   rN   r	   r   rO   rP   )rA   r(   r   rE   rz  r|  r}  r~  r  ru  rQ   s              r,   r*   zeditSubscriptionPlan.post<  s0   &

 
 
.4
mmo))--.AB  $$Z0H!!'*E##''6K''++,=>O"**11R18??Rcmu  }B  OZ  kz?  {JW34())'233	 &GEF
$
%%&s$   D
D D 	E" EEENr   rV   r.   r,   r  r  5  s(    )>N;<5 =5&r.   r  c                   6    e Zd Z e ed            d        Zy)changeSubscriptionStatusrD   r   c                    	 t         j                  j                  |j                  d         }|j                  d   |_        |j                          |j                  dk(  r:t        j                  |d       t        |j                  j                  d            S t        j                  |d       t        |j                  j                  d            S # t        $ r+}t        j                  |d       t        d	      cY d }~S d }~ww xY w)
Nmain_idr   rK   1z Subscription status is activatedHTTP_REFERERz"Subscription status is deactivatedrF   r   )rt  r%   r#   rH   rK   rk   r   rN   r
   METArL   rO   rP   r	   rA   r(   pubrQ   s       r,   r*   zchangeSubscriptionStatus.postO  s    &!))--7<<	3J-K3X&3:88:	jjCW@A((899NN7@A((899	 &GEF
$
%%&$   BC 9C 	D
 D?D
D
NrS   rT   rU   r   r   r*   rV   r.   r,   r  r  N      >N;<& =&r.   r  c                   6    e Zd Z e ed            d        Zy)deleteSubscriptionMethodrD   r   c                     t         j                  j                  |      j                  t	        j
                                t        j                  |d       t        d      S )Nr   r  Deleted successfullyr  )	rt  r%   r&   r   r   r  r   rN   r	   r  s      r,   r#   zdeleteSubscriptionMethod.get`  sJ    ""b")00(,,.0I
723	&	''r.   Nr   rV   r.   r,   r  r  _  s    >N;<( =(r.   r  c                   :    e Zd ZdZ e ed            d        Zy)blogCategoryListingzblog_category_listing.htmlrD   r   c                    t         j                  j                  d      j                  d      }|j                  j                  d      }|r:t         j                  j                  t        |      d      j                  d      }t        |d      }|j                  j                  d      }|j                  |      }t        || j                  t                     S NTr   r   r  name__icontainsr  r  )r   r%   r&   r   r"   r#   r   r   r  r   r?   r~   rA   r(   r  r&  r  r  cat_objs          r,   r#   zblogCategoryListing.getj  s    ""))T)BKKER()+##**1[+I]a*bkklqr8!$)'+{+'	**68	44r.   Nr   rV   r.   r,   r  r  h  s#    ->N;<5 =5r.   r  c                   @    e Zd ZdZ e ed            d        Zd Zy)addBlogCategoryzadd_blog_category.htmlrD   r   c                 @    t        || j                  t                     S r   r   r@   s     r,   r#   zaddBlogCategory.getx  s     
**68	44r.   c                    t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }t        j                  j                  |      }t        j                  j                  ||      }t        j                  |d       t        d      S t        || j                  t                     S Nr   categoryr   r   r  Created successfully/blog-category-listing)r   addblogcategoryformrH   rI   rJ   r#   r   r%   r   r   rN   r	   r   r?   r~   )rA   r(   rE   r   r  category_objr  s          r,   r*   zaddBlogCategory.post}  s    		"	"7<<	0$	]]_





'4##J/8''++x+8<"")))N7G34
+
,,
++FH
55r.   Nr   rV   r.   r,   r  r  v  s(    )>N;<5 =5
6r.   r  c                   @    e Zd ZdZ e ed            d        Zd Zy)editBlogCategoryzedit_blog_category.htmlrD   r   c                     t         j                  j                  |      j                         }t	        || j
                  t                     S r\  )r   r%   r&   r'   r   r?   r~   rA   r(   r   r  s       r,   r#   zeditBlogCategory.get  s;    ""))R)0668'	**68	44r.   c                    t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }t        j                  j                  |      }t        j                  j                  |      j                  ||       t        j                  |d       t        d      S t        || j                  t                     S r  )r   r  rH   rI   rJ   r#   r   r%   r&   r   r   rN   r	   r   r?   r~   )rA   r(   r   rE   r   r  r  s          r,   r*   zeditBlogCategory.post  s    

#
#GLL
1$	]]_





'4##J/8''++x+8<2&--T<-PG34
+
,,
++FH
55r.   Nr   rV   r.   r,   r  r    s(    *>N;<5 =5
6r.   r  c                   6    e Zd Z e ed            d        Zy)changeBlogCategoryStatusrD   r   c                    	 t         j                  j                  |j                  d         }|j                  d   |_        |j                          |j                  dk(  r:t        j                  |d       t        |j                  j                  d            S t        j                  |d       t        |j                  j                  d            S # t        $ r+}t        j                  |d       t        d	      cY d }~S d }~ww xY w
Nr  r   rK   r  zCategory status is activatedr  zCategory is deactivatedrF   r   )r   r%   r#   rH   rK   rk   r   rN   r
   r  rL   rO   rP   r	   r  s       r,   r*   zchangeBlogCategoryStatus.post  s    &%%))w||I/F)G3X&3:88:	jjCW<=((899NN756((899	 &GEF
$
%%&r  Nr  rV   r.   r,   r  r    r  r.   r  c                   6    e Zd Z e ed            d        Zy)deleteBlogCategoryrD   r   c                    t         j                  j                  |d      j                         }t        j                  j                         |_        |j                          t        j                  |d       t        d      S )NTr  Category deleted successfullyr  )r   r%   r&   r'   r   r  rM   rk   r   rN   r	   r  s       r,   r#   zdeleteBlogCategory.get  sc    ##**bD*JPPR'&&**,'	,,.
7;<	*	++r.   Nr   rV   r.   r,   r  r    s    >N;<, =,r.   r  c                   :    e Zd ZdZ e ed            d        Zy)blogListingzblog_listing.htmlrD   r   c                    t         j                  j                  d      j                  d      }|j                  j                  d      }|rGt         j                  j                  t        |      t        |      z  d      j                  d      }t        |d      }|j                  j                  d      }|j                  |      }t        || j                  t                     S )	NTr   r   r  category__name__icontainstitle__icontainsr  r  )Blogsr%   r&   r   r"   r#   r   r   r  r   r?   r~   )rA   r(   r  r&  r  r  blog_objs          r,   r#   zblogListing.get  s    ]]!!T!:CCEJ()+mm""1#MaalNm#m  BF"  G  P  P  QV  W8!$)'+,(	**68	44r.   Nr   rV   r.   r,   r  r    s#    $>N;<5 =5r.   r  c                   @    e Zd ZdZ e ed            d        Zd Zy)addBlogzadd_blog.htmlrD   r   c                     t         j                  j                  d      }t        || j                  t                     S NTr   )r   r%   r&   r   r?   r~   rA   r(   r  s      r,   r#   zaddBlog.get  s2    ##**D*A(	**68	44r.   c                    t        j                  |j                        }|j                         r-|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }t        j                  j                  |      }t        j                  j                  ||||j                  j                        }|j                  j                  d      rIt        |j                  j                  d            }d|z   }t        |      |_        |j!                          t#        j$                  |d       t'        d	      S t)        || j*                  t-                     S )
Nr   r   r  r   r   r   r  r3   
blog_imager\   r  /blog-listing)r   addblogformrH   rI   rJ   r#   r   r%   r  r   r3   r   r   r   rh   r  rk   r   rN   r	   r   r?   r~   )	rA   r(   rE   r   r   r  r  r  r   s	            r,   r*   zaddBlog.post  s    			7<<	($	]]_  )5##I.7##J/8 ((,,,9<mm""5,^e^j^j^m^m"n8mm%GMM--l;<GKGg,HMMOG34
?
##
++FH
55r.   Nr   rV   r.   r,   r  r    s(     >N;<5 =56r.   r  c                   @    e Zd ZdZ e ed            d        Zd Zy)editBlogzedit_blog.htmlrD   r   c                     t         j                  j                  d      }t        j                  j                  |      j	                         }t        || j                  t                     S )NTr   r   )r   r%   r&   r  r'   r   r?   r~   )rA   r(   r   r  r  s        r,   r#   zeditBlog.get  sR    ##**D*A(mm""b")//1(	**68	44r.   c                 L   t        j                  |j                        }|j                         rV|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }t        j                  j                  |      }t        j                  j                  |      j                  ||||j                  j                         |j                  j                  d      rbt        |j                  j                  d            }d|z   }t        j                  j                  |      j                  t        |             t!        j"                  |d	       t%        d
      S t'        || j(                  t+                     S )Nr   r   r  r   r  r  r\   )r  r  r  )r   r  rH   rI   rJ   r#   r   r%   r  r&   r   r3   r   r   r   rh   r   rN   r	   r   r?   r~   )	rA   r(   r   rE   r   r   r  r  r   s	            r,   r*   zeditBlog.post  s>   


GLL
)$	]]_  )5##I.7##J/8 ((,,,9<==2%%eG\ahamamapap%qmm%GMM--l;<GKG	MMB&&CL&AG34
?
##
++FH
55r.   Nr   rV   r.   r,   r  r    s(    !>N;<5 =5
6r.   r  c                   6    e Zd Z e ed            d        Zy)changeBlogStatusrD   r   c                    	 t         j                  j                  |j                  d         }|j                  d   |_        |j                          |j                  dk(  r:t        j                  |d       t        |j                  j                  d            S t        j                  |d       t        |j                  j                  d            S # t        $ r+}t        j                  |d       t        d	      cY d }~S d }~ww xY w)
Nr  r   rK   r  zBlog status is activatedr  zBlog is deactivatedrF   r   )r  r%   r#   rH   rK   rk   r   rN   r
   r  rL   rO   rP   r	   r  s       r,   r*   zchangeBlogStatus.post  s    &!!w||I'>!?3X&3:88:	jjCW89((899NN712((899	 &GEF
$
%%&r  Nr  rV   r.   r,   r  r    r  r.   r  c                   6    e Zd Z e ed            d        Zy)
deleteBlogrD   r   c                    t         j                  j                  |d      j                         }t        j                  j                         |_        |j                          t        j                  |d       t        d      S )NTr  zBlog deleted successfullyr  )r  r%   r&   r'   r   r  rM   rk   r   rN   r	   r  s       r,   r#   zdeleteBlog.get  s`    mm""bD"BHHJ'&&**,'	,,.
778	/	""r.   Nr   rV   r.   r,   r  r    s    >N;<# =#r.   r  c                   :    e Zd ZdZ e ed            d        Zy)communityPostzcommunity_post.htmlrD   r   c                     t         j                  j                  d      }t        |d      }|j                  j                  d      }|j                  |      }t        || j                  t                     S NTr   r  r  )
	Communityr%   r&   r   r"   r#   r  r   r?   r~   )rA   r(   r  r  r  com_objs         r,   r#   zcommunityPost.get  s`    %%%>(!$)'+{+'	**68	44r.   Nr   rV   r.   r,   r  r    s#    &>N;<5 =5r.   r  c                   @    e Zd ZdZ e ed            d        Zd Zy)editCommunityPostzedit_community_post.htmlrD   r   c                     t         j                  j                  |d      j                         }t	        || j
                  t                     S r  )r  r%   r&   r'   r   r?   r~   )rA   r(   r   r  s       r,   r#   zeditCommunityPost.get&  s=    $$d$CIIK'	**68	44r.   c                 x   t        j                  |j                        }|j                         rm|j                  j                  d      }t        j                  j                  |d      j                  |       t        j                  |d       t        d      S t        || j                  t                     S )Nr   Tr  )r   r6  z/community-post)r   editcommunityformrH   rI   rJ   r#   r  r%   r&   r   r   rN   r	   r   r?   r~   )rA   r(   r   rE   r   s        r,   r*   zeditCommunityPost.post,  s    

!
!',,
/$	]]_""9-7rT:AA'ARG34
$
%%
++FH
55r.   Nr   rV   r.   r,   r  r  $  s(    +>N;<5 =5
6r.   r  c                   :    e Zd ZdZ e ed            d        Zy)getSubscriberszsubscriber_listing.htmlrD   r   c                     t         j                  j                         }t        |d      }|j                  j                  d      }|j                  |      }t        || j                  t                     S rj  )
r   r%   r   r   r"   r#   r  r   r?   r~   )rA   r(   r  r  r  r   s         r,   r#   zgetSubscribers.get;  s[    !))--/(!$)'+{+'	**68	44r.   Nr   rV   r.   r,   r  r  9  s#    *>N;<5 =5r.   r  c                   :    e Zd ZdZ e ed            d        Zy)getWebinarListingzwebinar_listing.htmlrD   r   c                 @    t        || j                  t                     S r   r   r@   s     r,   r#   zgetWebinarListing.getF  r   r.   Nr   rV   r.   r,   r  r  D  s#    '>N;<5 =5r.   r  c                       e Zd ZdZd Zy)getWebinarDetailszwebinar_details.htmlc                 @    t        || j                  t                     S r   r   r@   s     r,   r#   zgetWebinarDetails.getN  s    	**68	44r.   Nr+  rV   r.   r,   r  r  L  s    '5r.   r  c                   :    e Zd ZdZ e ed            d        Zy)eventListingzevent_listing.htmlrD   r   c                     t         j                  j                  d      }t        |d      }|j                  j                  d      }|j                  |      }t        || j                  t                     S r  )
r   r%   r&   r   r"   r#   r  r   r?   r~   )rA   r(   r  r  r  	event_objs         r,   r#   zeventListing.getU  s^    ^^""d";(!$)'+  -)	**68	44r.   Nr   rV   r.   r,   r  r  S  s#    %>N;<5 =5r.   r  c                   @    e Zd ZdZ e ed            d        Zd Zy)addEventzadd_event.htmlrD   r   c                 @    t        || j                  t                     S r   r   r@   s     r,   r#   zaddEvent.get`  r   r.   c           	         t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }t        j                  j                  |j                  j                        }	t        j                  j                  |||||||	      }
|j                  j                  d	      rIt        |j                  j                  d	            }d
|z   }t        |      |
_        |
j!                          t#        j$                  |d       t'        d      S t)        || j*                  t-                     S )N
event_namedescriptiondate
start_timeend_timelocationr   )r  r  r  r  r  r  r3   event_imager\   r  /event-listing)r   addEventformrH   rI   rJ   r#   r$   r%   r3   r   r   r   r   r   rh   r  rk   r   rN   r	   r   r?   r~   )rA   r(   rE   r  r  r  r  r  r  r   r  r   s               r,   r*   zaddEvent.postd  sw   


W\\
*$	]]_!!%%l3:""&&}5;





'4!!%%l3:##J/8##J/8llGLLOO48~~$$
{X\hr  }E  OW  _g$  h9mm&GMM--m<=GKGLINNG34
#
$$
++FH
55r.   Nr   rV   r.   r,   r  r  ^  s(    !>N;<5 =56r.   r  c                   @    e Zd ZdZ e ed            d        Zd Zy)	editEventzedit_event.htmlrD   r   c                     t         j                  j                  |      }t        || j                  t                     S r\  )r   r%   r#   r   r?   r~   )rA   r(   r   r  s       r,   r#   zeditEvent.get|  s0    nn  B ')	**68	44r.   c                    t        j                  |j                        }|j                         ru|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }	t        j                  j                  |      j                  ||||||	      }
|j                  j                  d	      rbt        |j                  j                  d	            }d
|z   }t        j                  j                  |      j                  t        |             t        j                  |d       t        d      S t!        || j"                  t%                     S )Nr  r  r  r  r  r  r   )r  r  r  r  r  r  r  r\   )r  r6  r  )r   r  rH   rI   rJ   r#   r   r%   r&   r   r   r   rh   r   rN   r	   r   r?   r~   )rA   r(   r   rE   r  r  r  r  r  r  r  r   s               r,   r*   zeditEvent.post  su   


W\\
*$	]]_!!%%l3:""&&}5;





'4!!%%l3:##J/8##J/8~~$$$+22jU`fj  wA  KS  ]e2  f9mm&GMM--m<=GKG
NNR ''c'l'CG34
#
$$
++FH
55r.   Nr   rV   r.   r,   r  r  z  s(    ">N;<5 =5
6r.   r  c                   :    e Zd ZdZ e ed            d        Zy)	viewEventzview_event.htmlrD   r   c                     t         j                  j                  |      j                         }t	        || j
                  t                     S r\  )r   r%   r&   r'   r   r?   r~   )rA   r(   r   view_objs       r,   r#   zviewEvent.get  s9    ^^""b")//1(	**68	44r.   Nr   rV   r.   r,   r  r    s#    ">N;<5 =5r.   r  c                   6    e Zd Z e ed            d        Zy)deleteEventrD   r   c                    t         j                  j                  |d      j                         }t        j                  j                         |_        |j                          t        j                  |d       t        d      S )NTr  zEvent deleted successfullyr  )r   r%   r&   r'   r   r  rM   rk   r   rN   r	   r  s       r,   r#   zdeleteEvent.get  sa    nn##rT#CIIK'&&**,'	,,.
789	"	##r.   Nr   rV   r.   r,   r  r    s    >N;<$ =$r.   r  c                   :    e Zd ZdZ e ed            d        Zy)reportSectionzreport_section.htmlrD   r   c                 @    t        || j                  t                     S r   r   r@   s     r,   r#   zreportSection.get  r   r.   Nr   rV   r.   r,   r  r    s#    &>N;<5 =5r.   r  c                   :    e Zd ZdZ e ed            d        Zy)investeduCategoryzinvest_edu_category.htmlrD   r   c                    t         j                  j                  d      j                  d      }|j                  j                  d      }|r:t         j                  j                  t        |      d      j                  d      }t        |d      }|j                  j                  d      }|j                  |      }t        || j                  t                     S r  )InvestmentEducationCategoryr%   r&   r   r"   r#   r   r   r  r   r?   r~   r  s          r,   r#   zinvesteduCategory.get  s    (00777NWWX]^()+)1188[9Ymq8r{{  }B  C8!$)'+{+'	**68	44r.   Nr   rV   r.   r,   r  r    s#    +>N;<5 =5r.   r  c                   @    e Zd ZdZ e ed            d        Zd Zy)addInvesteduCategoryzadd_invest_edu_category.htmlrD   r   c                 @    t        || j                  t                     S r   r   r@   s     r,   r#   zaddInvesteduCategory.get  r   r.   c                    t        j                  |j                        }|j                         rx|j                  j                  d      }|j                  j                  d      }t        j                  j                  ||       t        j                  |d       t        d      S t        || j                  t                     S )Nr   is_subscriptionr   r  Added successfully/invest-edu-category)r   addInvestEduCategoryFormrH   rI   rJ   r#   r
  r%   r   r   rN   r	   r   r?   r~   )rA   r(   rE   r   r  s        r,   r*   zaddInvesteduCategory.post  s    

(
(
6$	]]_





'4''++,=>?&&--4-XG12
)
**
++FH
55r.   Nr   rV   r.   r,   r  r    s(    />N;<5 =5	6r.   r  c                   @    e Zd ZdZ e ed            d        Zd Zy)editInvesteduCategoryzedit_invest_edu_category.htmlrD   r   c                     t         j                  j                  |d      j                         }t	        || j
                  t                     S r  )r
  r%   r&   r'   r   r?   r~   r  s       r,   r#   zeditInvesteduCategory.get  s=    '//66"t6TZZ\'	**68	44r.   c                    t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }t        j                  j                  |d      j                  ||       t        j                  |d       t        d      S t        || j                  t                     S )Nr   r  Tr  r  r6  r  )r   r  rH   rI   rJ   r#   r
  r%   r&   r   r   rN   r	   r   r?   r~   )rA   r(   r   rE   r   r  s         r,   r*   zeditInvesteduCategory.post  s    

(
(
6$	]]_





'4''++,=>?&&--"t-LSSY]n}S~G34
)
**
++FH
55r.   Nr   rV   r.   r,   r  r    s(    0>N;<5 =5	6r.   r  c                   6    e Zd Z e ed            d        Zy)deleteInvesteduCategoryrD   r   c                    t         j                  j                  |d      j                         }t        j                  j                         |_        |j                          t        j                  |d       t        d      S )NTr  r  r  )r
  r%   r&   r'   r   r  rM   rk   r   rN   r	   r  s       r,   r#   zdeleteInvesteduCategory.get  sd    )1188BRV8X^^`'&&**,'	,,.
7;<	(	))r.   Nr   rV   r.   r,   r  r    s    >N;<* =*r.   r  c                   6    e Zd Z e ed            d        Zy)changeInvesteduCategoryStatusrD   r   c                    	 t         j                  j                  |j                  d         }|j                  d   |_        |j                          |j                  dk(  r:t        j                  |d       t        |j                  j                  d            S t        j                  |d       t        |j                  j                  d            S # t        $ r+}t        j                  |d       t        d	      cY d }~S d }~ww xY wr  )r
  r%   r#   rH   rK   rk   r   rN   r
   r  rL   rO   rP   r	   r  s       r,   r*   z"changeInvesteduCategoryStatus.post  s    &+3377W\\)=T7U3X&3:88:	jjCW<=((899NN756((899	 &GEF
$
%%&r  Nr  rV   r.   r,   r  r    r  r.   r  c                   :    e Zd ZdZ e ed            d        Zy)investeduSubCategoryzinvest_edu_sub_category.htmlrD   r   c                    t         j                  j                  d      j                  d      }|j                  j                  d      }|rGt         j                  j                  t        |      t        |      z  d      j                  d      }t        |d      }|j                  j                  d      }|j                  |      }t        || j                  t                     S )	NTr   r   r  r  r  r  r  )InvestmentEducationSubCategoryr%   r&   r   r"   r#   r   r   r  r   r?   r~   r  s          r,   r#   zinvesteduSubCategory.get  s    +33::D:QZZ[`a()+,44;;AZe<fgh  |G  hH  =H  \`;  a  j  j  kp  q8!$)'+{+'	**68	44r.   Nr   rV   r.   r,   r  r    s#    />N;<5 =5r.   r  c                   @    e Zd ZdZ e ed            d        Zd Zy)addInvesteduSubCategoryzadd_invest_edu_subcategory.htmlrD   r   c                     t         j                  j                  d      }t        || j                  t                     S r  )r
  r%   r&   r   r?   r~   )rA   r(   main_categorys      r,   r#   zaddInvesteduSubCategory.get  s2    -55<<d<S-	**68	44r.   c                    t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }t        j                  j                  |      }t        j                  j                  ||       t        j                  |d       t        d      S t        || j                  t                     S )Nr   r  r   r  r  /invest-edu-subcategory)r   addInvestEduSubCategoryFormrH   rI   rJ   r#   r
  r%   r!  r   r   rN   r	   r   r?   r~   )rA   r(   rE   r   r  r  s         r,   r*   zaddInvesteduSubCategory.post  s    

+
+GLL
9$	]]_





'4"":.7-5599w9G<!))00dl0SG12
,
--
++FH
55r.   Nr   rV   r.   r,   r#  r#  
  s(    2>N;<5 =5
6r.   r#  c                   @    e Zd ZdZ e ed            d        Zd Zy)editInvesteduSubCategoryz edit_invest_edu_subcategory.htmlrD   r   c                     t         j                  j                  d      }t        j                  j                  |d      j	                         }t        || j                  t                     S NTr   r  )r
  r%   r&   r!  r'   r   r?   r~   )rA   r(   r   r%  r  s        r,   r#   zeditInvesteduSubCategory.get  sW    -55<<d<S-*2299RRV9W]]_'	**68	44r.   c                    t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }t        j                  j                  |      }t        j                  j                  |      j                  ||       t        j                  |d       t        d      S t        || j                  t!                     S )Nr   r  r   r  r6  r'  )r   r(  rH   rI   rJ   r#   r
  r%   r!  r&   r   r   rN   r	   r   r?   r~   )rA   r(   r   rE   r   r  r  s          r,   r*   zeditInvesteduSubCategory.post%  s    

+
+GLL
9$	]]_





'4"":.7-5599w9G<!))00R08??TUa?bG34
,
--
++FH
55r.   Nr   rV   r.   r,   r*  r*    s(    3>N;<5 =5

6r.   r*  c                   6    e Zd Z e ed            d        Zy)deleteInvesteduSubCategoryrD   r   c                    t         j                  j                  |d      j                         }t        j                  j                         |_        |j                          t        j                  |d       t        d      S )NTr  z SubCategory deleted successfullyr'  )r!  r%   r&   r'   r   r  rM   rk   r   rN   r	   r  s       r,   r#   zdeleteInvesteduSubCategory.get4  sd    ,44;;rUY;[aac'&&**,'	,,.
7>?	+	,,r.   Nr   rV   r.   r,   r/  r/  3  s    >N;<- =-r.   r/  c                   6    e Zd Z e ed            d        Zy) changeInvesteduSubCategoryStatusrD   r   c                    	 t         j                  j                  |j                  d         }|j                  d   |_        |j                          |j                  dk(  r:t        j                  |d       t        |j                  j                  d            S t        j                  |d       t        |j                  j                  d            S # t        $ r+}t        j                  |d       t        d	      cY d }~S d }~ww xY w)
Nr  r   rK   r  zSubCategory status is activatedr  zSubCategory is deactivatedrF   r   )r!  r%   r#   rH   rK   rk   r   rN   r
   r  rL   rO   rP   r	   r  s       r,   r*   z%changeInvesteduSubCategoryStatus.post>  s    &.66::Y@W:X3X&3:88:	jjCW?@((899NN789((899	 &GEF
$
%%&r  Nr  rV   r.   r,   r2  r2  =  r  r.   r2  c                   :    e Zd ZdZ e ed            d        Zy)investmentEducationListingzinvest_edu_listing.htmlrD   r   c                    t         j                  j                  d      j                  d      }|j                  j                  d      }|rGt         j                  j                  t        |      t        |      z  d      j                  d      }t        |d      }|j                  j                  d      }|j                  |      }t        || j                  t                     S 	NTr   r   r  )sub_category__name__icontainsr  r  r  )r   r%   r&   r   r"   r#   r   r   r  r   r?   r~   )rA   r(   r  r&  r  r  content_objs          r,   r#   zinvestmentEducationListing.getR  s    '//666MVVW\]()+(0077Ze8fgh  }H  hI  9I  ]a7  b  k  k  lq  r8!$)'+"";/+	**68	44r.   Nr   rV   r.   r,   r5  r5  P  s#    *>N;<5 =5r.   r5  c                   @    e Zd ZdZ e ed            d        Zd Zy)addInvestmentEducationzadd_invest_edu.htmlrD   r   c                     t         j                  j                  d      }t        || j                  t                     S r  )r!  r%   r&   r   r?   r~   r  s      r,   r#   zaddInvestmentEducation.get`  s2    +33::D:Q(	**68	44r.   c                    t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }t        j                  j                  |      }t        j                  j                  |||      }|j                  j                  d      rIt        |j                  j                  d            }d|z   }t        |      |_        |j                          t        j                   |d       t#        d	      S t%        || j&                  t)                     S )
Nr   r   r  r   r   r   sub_categoryvideor\   r  /investment-education-listing)r   addInvestEduContentFormrH   rI   rJ   r#   r!  r%   r   r   r   r   rh   r@  rk   r   rN   r	   r   r?   r~   )	rA   r(   rE   r   r   r  r  r   r   s	            r,   r*   zaddInvestmentEducation.poste  s   

'
'
5$	]]_  )5""9-7  $$Z08088<<(<K<(0077eGam7n8mm GMM--g67GKG\HNMMOG34
2
33
++FH
55r.   Nr   rV   r.   r,   r;  r;  ^  s(    &>N;<5 =56r.   r;  c                   @    e Zd ZdZ e ed            d        Zd Zy)editInvestmentEducationzedit_invest_edu.htmlrD   r   c                     t         j                  j                  d      }t        j                  j                  |d      j	                         }t        || j                  t                     S r,  )r!  r%   r&   r   r'   r   r?   r~   )rA   r(   r   r  r   s        r,   r#   zeditInvestmentEducation.get}  sW    +33::D:Q((0077RQU7V\\^(	**68	44r.   c                 "   t        j                  |j                        }|j                         rA|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }t        j                  j                  |      }t        j                  j                  |      j                  |||      }|j                  j                  d      rbt        |j                  j                  d            }	d|	z   }	t        j                  j                  |      j                  t        |	             t        j                  |d	       t!        d
      S t#        || j$                  t'                     S )Nr   r   r  r   r>  r@  r\   r@  r6  rA  )r   rB  rH   rI   rJ   r#   r!  r%   r   r&   r   r   r   rh   r   rN   r	   r   r?   r~   )
rA   r(   r   rE   r   r   r  r  r   r   s
             r,   r*   zeditInvestmentEducation.post  s8   

'
'
5$	]]_  )5""9-7  $$Z08088<<(<K<(0077R7@GGe\cq}G~8mm GMM--g67GKG&&--2-6==c'l=SG34
2
33
++FH
55r.   Nr   rV   r.   r,   rD  rD  {  s(    '>N;<5 =5
6r.   rD  c                   6    e Zd Z e ed            d        Zy)deleteInvesteduContentrD   r   c                    t         j                  j                  |d      j                         }t        j                  j                         |_        |j                          t        j                  |d       t        d      S )NTr  z)Investment education deleted successfullyrA  )r   r%   r&   r'   r   r  rM   rk   r   rN   r	   r  s       r,   r#   zdeleteInvesteduContent.get  sd    (00772QU7W]]_'&&**,'	,,.
7GH	1	22r.   Nr   rV   r.   r,   rI  rI    s    >N;<3 =3r.   rI  c                   6    e Zd Z e ed            d        Zy)changeInvesteduContentStatusrD   r   c                    	 t         j                  j                  |j                  d         }|j                  d   |_        |j                          |j                  dk(  r:t        j                  |d       t        |j                  j                  d            S t        j                  |d       t        |j                  j                  d            S # t        $ r+}t        j                  |d       t        d	      cY d }~S d }~ww xY w)
Nr  r   rK   r  zInvestment status is activatedr  zInvestment is deactivatedrF   r   )r   r%   r#   rH   rK   rk   r   rN   r
   r  rL   rO   rP   r	   r  s       r,   r*   z!changeInvesteduContentStatus.post  s    &*2266GLL<S6T3X&3:88:	jjCW>?((899NN778((899	 &GEF
$
%%&r  Nr  rV   r.   r,   rL  rL    r  r.   rL  c                   :    e Zd ZdZ e ed            d        Zy)jobFunctionListingzjob_function_listing.htmlrD   r   c                    t         j                  j                  d      j                  d      }|j                  j                  d      }|r:t         j                  j                  t        |      d      j                  d      }t        |d      }|j                  j                  d      }|j                  |      }t        || j                  t                     S )NTr   r   r  r  r  r  )r0  r%   r&   r   r"   r#   r   r   r  r   r?   r~   rA   r(   r  r&  r  r  job_objs          r,   r#   zjobFunctionListing.get  s    !!(($(?HHO()+""))!{*K_c)dmmnst8!$)'+{+'	**68	44r.   Nr   rV   r.   r,   rO  rO    s#    ,>N;<5 =5r.   rO  c                   @    e Zd ZdZ e ed            d        Zd Zy)jobAddFunctionzadd_job_function.htmlrD   r   c                 @    t        || j                  t                     S r   r   r@   s     r,   r#   zjobAddFunction.get  r   r.   c                 V   t        j                  |j                        }|j                         r\|j                  j                  d      }t        j                  j                  |      }t        j                  |d       t        d      S t        || j                  t                     S )Nr   r   r  /job-function-listing)r   addJobFunctionFormrH   rI   rJ   r#   r0  r%   r   r   rN   r	   r   r?   r~   rA   r(   rE   r   r   s        r,   r*   zjobAddFunction.post  s    

"
"7<<
0$	]]_  )5"")))68G34
*
++
++FH
55r.   Nr   rV   r.   r,   rT  rT    s(    (>N;<5 =56r.   rT  c                   @    e Zd ZdZ e ed            d        Zd Zy)jobEditFunctionzedit_job_function.htmlrD   r   c                     t         j                  j                  |      j                         }t	        || j
                  t                     S r\  )r0  r%   r&   r'   r   r?   r~   rA   r(   r   rR  s       r,   r#   zjobEditFunction.get  s;    !!((b(1779'	**68	44r.   c                 v   t        j                  |j                        }|j                         rl|j                  j                  d      }t        j                  j                  |      j                  |      }t        j                  |d       t        d      S t        || j                  t                     S )Nr   r   rW  r6  rX  )r   rY  rH   rI   rJ   r#   r0  r%   r&   r   r   rN   r	   r   r?   r~   rA   r(   r   rE   r   r   s         r,   r*   zjobEditFunction.post  s    

"
"7<<
0$	]]_  )5""))R)077e7D8G34
*
++
++FH
55r.   Nr   rV   r.   r,   r\  r\    s(    )>N;<5 =56r.   r\  c                   6    e Zd Z e ed            d        Zy)deleteJobFunctionrD   r   c                    t         j                  j                  |d      j                         }t        j                  j                         |_        |j                          t        j                  |d       t        d      S )NTr  z!Job function deleted successfullyrX  )r0  r%   r&   r'   r   r  rM   rk   r   rN   r	   r  s       r,   r#   zdeleteJobFunction.get  sc    ""))R4)IOOQ'&&**,'	,,.
7?@	)	**r.   Nr   rV   r.   r,   rb  rb    s    >N;<+ =+r.   rb  c                   :    e Zd ZdZ e ed            d        Zy)jobRoleListingzjob_role_listing.htmlrD   r   c                    t         j                  j                  d      j                  d      }|j                  j                  d      }|rGt         j                  j                  t        |      t        |      z  d      j                  d      }t        |d      }|j                  j                  d      }|j                  |      }t        || j                  t                     S r7  )r1  r%   r&   r   r"   r#   r   r   r  r   r?   r~   rQ  s          r,   r#   zjobRoleListing.get  s    $$d$;DDUK()+%%a&TUVjuUv&v  KO%  P  Y  Y  Z_  `8!$)'+{+'	**68	44r.   Nr   rV   r.   r,   re  re    s#    (>N;<5 =5r.   re  c                   @    e Zd ZdZ e ed            d        Zd Zy)
jobAddRolezadd_job_role.htmlrD   r   c                 @    t        || j                  t                     S r   r   r@   s     r,   r#   zjobAddRole.get  r   r.   c                 V   t        j                  |j                        }|j                         r\|j                  j                  d      }t        j                  j                  |      }t        j                  |d       t        d      S t        || j                  t                     S )Nr   rW  r  /job-level-listing)r   addJobRoleFormrH   rI   rJ   r#   r1  r%   r   r   rN   r	   r   r?   r~   rZ  s        r,   r*   zjobAddRole.post  s    


w||
,$	]]_  )5%%E%28G34
'
((
++FH
55r.   Nr   rV   r.   r,   rh  rh     s(    $>N;<5 =56r.   rh  c                   @    e Zd ZdZ e ed            d        Zd Zy)jobEditRolezedit_job_role.htmlrD   r   c                     t         j                  j                  |      j                         }t	        || j
                  t                     S r\  )r1  r%   r&   r'   r   r?   r~   r^  s       r,   r#   zjobEditRole.get  s;    $$"$-335'	**68	44r.   c                 v   t        j                  |j                        }|j                         rl|j                  j                  d      }t        j                  j                  |      j                  |      }t        j                  |d       t        d      S t        || j                  t                     S )Nr   r   rW  r6  rk  )r   rl  rH   rI   rJ   r#   r1  r%   r&   r   r   rN   r	   r   r?   r~   r`  s         r,   r*   zjobEditRole.post  s    


w||
,$	]]_  )5%%%,33%3@8G34
'
((
++FH
55r.   Nr   rV   r.   r,   rn  rn    s(    %>N;<5 =56r.   rn  c                   6    e Zd Z e ed            d        Zy)deleteJobRolerD   r   c                    t         j                  j                  |d      j                         }t        j                  j                         |_        |j                          t        j                  |d       t        d      S )NTr  zJob level deleted successfullyrk  )r1  r%   r&   r'   r   r  rM   rk   r   rN   r	   r  s       r,   r#   zdeleteJobRole.get%  sc    %%t%EKKM'&&**,'	,,.
7<=	&	''r.   Nr   rV   r.   r,   rr  rr  $  s    >N;<( =(r.   rr  c                   :    e Zd ZdZ e ed            d        Zy)quizListingzquiz_listing.htmlrD   r   c                 
   t         j                  j                         j                  d      }t	        |d      }|j
                  j                  d      }|j                  |      }t        || j                  t                     S )Nr   r  r  )	QuizModelr%   r   r   r   r"   r#   r  r   r?   r~   )rA   r(   r  r  r  quiz_objs         r,   r#   zquizListing.get0  sf      $$&//6(!$)'+,(	**68	44r.   Nr   rV   r.   r,   ru  ru  .  s#    $>N;<5 =5r.   ru  c                   @    e Zd ZdZ e ed            d        Zd Zy)addQuestionzadd_quiz_question.htmlrD   r   c                 @    t        || j                  t                     S r   r   r@   s     r,   r#   zaddQuestion.get;  r   r.   c                 n   t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }t        j                  j                  ||||||      }	t        j                  |d       t        d	      S t        || j                  t                     S )
Nquestionop1op2op3op4ansr}  r~  r  r  r  r  r  /quiz-listing)r   addQuestionFormrH   rI   rJ   r#   rw  r%   r   r   rN   r	   r   r?   r~   )
rA   r(   rE   r}  r~  r  r  r  r  r   s
             r,   r*   zaddQuestion.post@  s    



-$	]]_##J/8					u	%3					u	%3					u	%3					u	%3					u	%3&&SSSUX]`&a8G34
?
##
++FH
55r.   Nr   rV   r.   r,   rz  rz  9  s(    )>N;<5 =56r.   rz  c                   @    e Zd ZdZ e ed            d        Zd Zy)editQuestionzedit_quiz_question.htmlrD   r   c                     t         j                  j                  |      j                         }t	        || j
                  t                     S r\  rw  r%   r&   r'   r   r?   r~   rA   r(   r   r   s       r,   r#   zeditQuestion.getQ  s;    &&B&/557(	**68	44r.   c                    t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }|j                  j                  d      }	t        j                  j                  |      j                  ||||||	      }
t        j                  |d	       t        d
      S t        || j                  t                     S )Nr}  r~  r  r  r  r  r   r  r6  r  )r   r  rH   rI   rJ   r#   rw  r%   r&   r   r   rN   r	   r   r?   r~   )rA   r(   r   rE   r}  r~  r  r  r  r  r   s              r,   r*   zeditQuestion.postW  s   



-$	]]_##J/8					u	%3					u	%3					u	%3					u	%3					u	%3&&B&/66SUX]`ehmp6q8G34
?
##
++FH
55r.   Nr   rV   r.   r,   r  r  O  s(    *>N;<5 =5
6r.   r  c                   :    e Zd ZdZ e ed            d        Zy)
quizDetailzquiz_detail.htmlrD   r   c                     t         j                  j                  |      j                         }t	        || j
                  t                     S r\  r  r  s       r,   r#   zquizDetail.geth  s;    %%2%.446(	**68	44r.   Nr   rV   r.   r,   r  r  f  s#    #>N;<5 =5r.   r  c                   6    e Zd Z e ed            d        Zy)deleteQuizQuestionrD   r   c                     t         j                  j                  |      j                         }|j	                          t        j                  |d       t        d      S )Nr   z"Quiz question deleted successfullyr  )rw  r%   r&   r'   rM  r   rN   r	   r  s       r,   r#   zdeleteQuizQuestion.getp  sJ    &&"&-335'	..
7@A	/	""r.   Nr   rV   r.   r,   r  r  o  s    >N;<# =#r.   r  c                   :    e Zd ZdZ e ed            d        Zy)getInvestmentResearchListzinvest_research_list.htmlrD   r   c                     t         j                  j                  d      }t        |d      }|j                  j                  d      }|j                  |      }t        || j                  t                     S r  )
r   r%   r&   r   r"   r#   r  r   r?   r~   )rA   r(   r  r  r  
invest_objs         r,   r#   zgetInvestmentResearchList.gety  s`    ''..$.G(!$)'+!!+.*	**68	44r.   Nr   rV   r.   r,   r  r  w  s#    ,>N;<5 =5r.   r  c                   @    e Zd ZdZ e ed            d        Zd Zy)addInvestmentResearchzadd_investment_research.htmlrD   r   c                 @    t        || j                  t                     S r   r   r@   s     r,   r#   zaddInvestmentResearch.get  r   r.   c                 (   t        j                  |j                        }|j                         rD|j                  j                  d      }|j                  j                  d      }t        j                  j                  ||      }|j                  j                  d      rKt        |j                  j                  d            }|}d|z   }t        |      |_        |j                          |j                  j                  d      rKt        |j                  j                  d            }|}d|z   }t        |      |_        |j                          t        j                   |d       t#        d      S t%        || j&                  t)                     S )	Nr   r   r  research_imager\   r@  r  /get-investment-research-list)r   addInvestResearchformrH   rI   rJ   r#   r   r%   r   r   r   rh   r  rk   r@  r   rN   r	   r   r?   r~   )rA   r(   rE   r   r   r  r   s          r,   r*   zaddInvestmentResearch.post  s:   

%
%gll
3$	]]_  )5##I.7"**11%1P:mm()GMM--.>?@GGKG #GJOOmm GMM--g67GGKG7|JOOG34
2
33
++FH
55r.   Nr   rV   r.   r,   r  r    s(    />N;<5 =56r.   r  c                   @    e Zd ZdZ e ed            d        Zd Zy)editInvestmentResearchzedit_investment_research.htmlrD   r   c                     t         j                  j                  |      j                         }t	        || j
                  t                     S r\  r   r%   r&   r'   r   r?   r~   )rA   r(   r   r  s       r,   r#   zeditInvestmentResearch.get  s;    !))00b09??A*	**68	44r.   c                    t        j                  |j                        }|j                         r|j                  j                  d      }|j                  j                  d      }t        j                  j                  |      j                  ||      }|j                  j                  d      rdt        |j                  j                  d            }|}d|z   }t        j                  j                  |      j                  t        |             |j                  j                  d      rdt        |j                  j                  d            }|}d|z   }t        j                  j                  |      j                  t        |      	       t        j                  |d
       t        d      S t!        || j"                  t%                     S )Nr   r   r   r  r  r\   )r  r@  rG  r  r  )r   r  rH   rI   rJ   r#   r   r%   r&   r   r   r   rh   r   rN   r	   r   r?   r~   )rA   r(   r   rE   r   r   r  r   s           r,   r*   zeditInvestmentResearch.post  so   

%
%gll
3$	]]_  )5##I.7 ((//R/8??V]?^8mm()GMM--.>?@GGKG%%2%.55s7|5Tmm GMM--g67GGKG%%2%.55c'l5KG34
2
33
++FH
55r.   Nr   rV   r.   r,   r  r    s(    0>N;<5 =5
6r.   r  c                   :    e Zd ZdZ e ed            d        Zy)detailInvestmentResearchz investment_research_details.htmlrD   r   c                     t         j                  j                  |      j                         }t	        || j
                  t                     S r\  r  r  s       r,   r#   zdetailInvestmentResearch.get  s;    ''..B.7==?(	**68	44r.   Nr   rV   r.   r,   r  r    s#    3>N;<5 =5r.   r  c                   6    e Zd Z e ed            d        Zy)deletedInvestmentResearchrD   r   c                     t         j                  j                  |      j                         }|j	                          t        j                  |d       t        d      S )Nr   r  r  )r   r%   r&   r'   rM  r   rN   r	   r  s       r,   r#   zdeletedInvestmentResearch.get  sK     ((//2/6<<>'	..
723	1	22r.   Nr   rV   r.   r,   r  r    s    >N;<3 =3r.   r  c           
         t         j                  j                  d      }t        d      }d|d<   t	        j
                  |      }|j                  g d       |D ]t  }|j                  |j                  |j                  |j                  |j                  j                  |j                  j                  |j                  |j                  g       v |S )NF)is_superusertext/csvcontent_typezattachment; filename="user.csv"Content-Disposition)EmailzPhone NumberUsernamez	Job LevelzJob FunctionzHas SubscriptionAddres)r$   r%   r&   r
   csvwriterwriterowr   r   r   r3  r   r2  r   addressr(   querysetresponser  items        r,   exportCsvUSerr    s    LLU3j1#D
 
**X
opT//4::d//t~~?S?SUYUfUfUlUlos  pE  pE  FJ  FR  FR  T  U r.   c                 z   t         j                  j                         }t        d      }d|d<   t	        j
                  |      }|j                  g d       |D ]^  }|j                  |j                  j                  |j                  j                  |j                  |j                  |j                  g       ` |S )Nr  r  z%attachment; filename="Subscriber.csv"r  )r  SubscriptionzBuy DatezExpiry Datez	Is Active)r   r%   r   r
   r  r  r  r3   r   subscriptionrz  buyDate
expiryDate	is_activer  s        r,   exportSubscriberUserr    s     ((,,.j1#J
 
**X
STT//499%%d&7&7&I&I4<<X\XgXgimiwiwyz r.   c                 T   t         j                  j                  d      }t        d      }d|d<   t	        j
                  |      }|j                  g d       |D ]I  }|j                  |j                  j                  |j                  |j                  |j                  g       K |S )NTr   r  r  z attachment; filename="Blogs.csv"r  )CategoryTitleContentCreated Date)r  r%   r&   r
   r  r  r  r  r   r   r   r   r  s        r,   exportBlogsr    s    MM  D 9j1#E
 
**X
@AT//4==%%tzz$,,QR r.   c           
         t         j                  j                  d      }t        d      }d|d<   t	        j
                  |      }|j                  g d       |D ]j  }|j                  |j                  |j                  j                  |j                  |j                  |j                  |j                  |j                  g       l |S )NTr   r  r  z!attachment; filename="Events.csv"r  )z
Event Namer  DescriptionDatez
Start TimezEnd TimeLocation)r   r%   r&   r
   r  r  r  r  r3   r   r  r  r  r  r  r  s        r,   exportEventsr    s    NN!!T!:j1#F
 
**X
efT//4??DII$6$6t7G7GSWSbSbcgcpcpquq~q~  A  B r.   c                 *   t         j                  j                  d      }t        d      }d|d<   t	        j
                  |      }|j                  g d       |D ]4  }|j                  |j                  |j                  |j                  g       6 |S )NTr   r  r  z#attachment; filename="Research.csv"r  )r  r  r  )
r   r%   r&   r
   r  r  r  r   r   r   r  s        r,   exportInvestmentResearchr    sy    &&---Fj1#H
 
**X
45T//4::t||DOO<= r.   c                    t         j                  j                  d      }t        d      }d|d<   t	        j
                  |      }|j                  g d       |D ]h  }|j                  |j                  j                  |j                  j                  j                  |j                  |j                  |j                  g       j |S )NTr   r  r  z$attachment; filename="Education.csv"r  )r  zSub Categoryr  r  r  )r   r%   r&   r
   r  r  r  r?  r   r  r   r   r   r  s        r,   exportInvestmentEducationr  	  s    &..555Nj1#I
 
**X
OPT//4$$))$*;*;*D*D*I*I4::VZVbVbcgcrcrst r.   )django.views.generic.baser   django.views.genericr   django.contrib.authr   r   r   django.shortcutsr   r	   django.http.responser
   admin_panel.modelsr0   r   django.contribr   django.corer   django.template.loaderr   mathrc   re   django.confr   django.core.paginatorr   django.httpr   django.contrib.auth.decoratorsr   django.utils.decoratorsr   	functionsdjango.db.modelsr   r   jsonr   astpasslib.hashr   handlerr   collectionsr   panel_apis.modelsr  r-   r4   r7   r9   rX   rx   r   r   r   r   r   r   r   r
  r  r  r  r-  r<  r?  rB  rG  rQ  rZ  r_  rh  rn  rq  rw  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  r5  r;  rD  rI  rL  rO  rT  r\  rb  re  rh  rn  rr  ru  rz  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rV   r.   r,   <module>r     su   * - ; ; - -    #  3     + $ 9 4     " 
 - 8 , #  
*#" #"L>, >:"> ">J5\ 5D.< .4& &2", "6D 6.6 6.5 56T 6"6d 6"" "5, 5&6| 6@5, 5) )5 5/t /,
5 
55 564 645, 55, 5&| &"6, 60&< &2&t &"(t (5, 56l 6*6| 6(&t &", ,5, 56l 666| 64&t &"# #5L 56 6*5\ 55 55 55< 56| 686 685 5$$ $5L 55 56< 6"6L 6(*d *&D &$5< 56l 6&6| 6,- -&t &&5 56\ 6:6l 663T 3&4 &(5 56\ 6$6l 6$+ +5\ 56 6$6, 6$(D (5, 56, 6,6< 6.5 5# #5 56L 6@6\ 6<5| 53 3r.   