
    E+h                     f    d dl mZ d dlmZmZ d dlmZ d dlmZ ddl	m
Z
  G d de      Zd	 Zd
 Zy)    )State)renderredirect)View)messages   )Artificial_Intelligencec                       e Zd Zd Zd Zy)ArtificialIntelligenceViewc                     |j                   j                  r-t        j                  j	                         }t        |dd|i      S t        j                  |d       t        d      S )NzRcustom_admin/entrepreneurship/artificial-intelligence/artificial-intelligence.htmlartificial_intelligencezyou have to login first
adminLogin)	useris_authenticatedr	   objectsallr   r   errorr   selfrequestr   s      Q/var/www/html/SAHYOG_SETU_ADMIN/entrepreneurship/artificial_intelligence/views.pygetzArtificialIntelligenceView.get   sg    <<((&=&E&E&I&I&K#'#w  {T  Vm  zn  o  oNN7$=>L))    c                 |   |j                   j                  rt               }|j                  j	                  d      |_        t        |j                  j	                  d            |_        |j                  j	                  d      |_        |j                  j	                  d      |_	        |j                  rE|j                  d   |_        |j                          t        j                  |d       t        d      S t        j                   |d       t        d      S t        j                   |d	       t        d
      S )Nlinkstatustitlecolorimagez)Artificial intelligence added sucessfullyadminArtificialIntelligencezImage is required.zyou have to login first.r   )r   r   r	   POSTr   r   intr   r   r   FILESr   saver   successr   r   r   s      r   postzArtificialIntelligenceView.post   s    <<(('>'@#+2<<+;+;F+C#(-01A1A(1K-L#*,3LL,<,<W,E#),3LL,<,<W,E#)}}07g0F'-',,.  *UV =>>w(<= =>>NN7$>?L))r   N)__name__
__module____qualname__r   r&    r   r   r   r      s    **r   r   c                 H   | j                   j                  rl| j                  j                  d      }t        j
                  j                  |      }|j                          t        j                  | d       t        d      S t        j                  | d       t        d      S )Nidr,   z-Artificial intelligence deleted successfully.r    You have to login first.r   )r   r   r!   r   r	   r   deleter   r%   r   r   r   r,   r   s      r   deleteArtificialIntelligencer1   +   s    ||$$\\d#"9"A"A"E"E2"E"N&&("QR566w :;%%r   c                 d   | j                   j                  rt        j                  j	                  |      }| j
                  r| j
                  d   |_        | j                  j	                  d      |_        t        | j                  j	                  d            |_
        | j                  j	                  d      |_        | j                  j	                  d      |_        |j                          t        j                  | d       t!        d      S t        j"                  | d	       t!        d
      S )Nr-   r   r   r   r   r   z-Artificial intelligence updated successfully.r    r.   r   )r   r   r	   r   r   r#   r   r!   r   r"   r   r   r   r$   r   r%   r   r   r0   s      r   updateArtificialIntelligencer3   8   s    ||$$"9"A"A"E"E2"E"N==,3MM',B#)'.||'7'7'?$),W\\-=-=h-G)H&(/(8(8(A%(/(8(8(A%$$&"QR566w :;%%r   N)	sre_parser   django.shortcutsr   r   django.viewsr   django.contribr   modelsr	   r   r1   r3   r*   r   r   <module>r9      s+     -  # +
* *@	&&r   