o
     #i                     @   s   d dl mZmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
mZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ G dd de
ZG dd deZG dd de
ZG dd de
ZG dd de
ZG dd deZdS )    )renderredirect)reverse)static)View)TemplateView
DetailView)date)Doctor)Departments)Appointments)Blogs)EmailWrapper)GlobalSettingsc                       s    e Zd ZdZ fddZ  ZS )HomePageViewzwebsite/index.htmlc           	         s   t  jdi |}tj }td}t  }t	jj
dd}tjj
dd}tjj
dd}||j|j|j|j|||||d	 |S )Nzassets/images/bg_main.pngT)status)	hospital_namehospital_locationemergency_contacthospital_emailbgdepartmentsdoctorstodayblogs )superget_context_datar   objectsfirstr   r	   r   	isoformatr   filterr
   r   updater   r   r   r   )	selfkwargscontextgsr   r   r   r   r   	__class__r   </var/www/GraceOrthoHospital/grace_ortho_care/common/views.pyr      s&   
zHomePageView.get_context_data)__name__
__module____qualname__template_namer   __classcell__r   r   r'   r)   r      s    r   c                   @   s   e Zd Zdd ZdS )BookAppointmentViewc              	   O   s   |j d}|j d}|j d}|j d}|j d}tjj|||||d tdd }	tj }
td	|d
}||||
j	j
|
j|
j|
j|
jd}|d| t|	S )Nphonenameemail
departmentappointment_date)department_idpatient_namepatient_phoner4   patient_email	home_pagez?booking_confirmation=okz%Grace Ortho Care Appointment Received)subjectto)	user_namedepartment_namer4   hospital_logor   r   r   r   z-email_templates/appointment_confirmation.html)POSTgetr   r   creater   r   r   r   r>   urlr   r   r   r   send_with_templater   )r#   requestargsr$   r0   r1   r2   r3   r4   rB   r&   	email_objr%   r   r   r)   post+   s:   	

zBookAppointmentView.postN)r*   r+   r,   rG   r   r   r   r)   r/   *   s    r/   c                   @      e Zd ZdZdS )AboutUsViewzwebsite/about_us.htmlNr*   r+   r,   r-   r   r   r   r)   rI   R       rI   c                   @   rH   )	OrthoViewzwebsite/ortho.htmlNrJ   r   r   r   r)   rL   V   rK   rL   c                   @   rH   )GalleryViewzwebsite/gallery.htmlNrJ   r   r   r   r)   rM   Z   rK   rM   c                   @   s"   e Zd ZeZdZdZdddZdS )BlogDetailViewzwebsite/blogs.htmlblogNc                 C   s   | j d}tjj|d S )Nblog_id)id)r$   r@   r   r   r!   r   )r#   querysetrP   r   r   r)   
get_objectc   s   zBlogDetailView.get_object)N)r*   r+   r,   r   modelr-   context_object_namerS   r   r   r   r)   rN   ^   s
    rN   N) django.shortcutsr   r   django.urlsr   django.templatetags.staticr   django.viewsr   django.views.genericr   r   datetimer	   doctors.modelsr
   common.modelsr   appointments.modelsr   blogs.modelsr   utilities.email_wrapperr   utilities.modelsr   r   r/   rI   rL   rM   rN   r   r   r   r)   <module>   s$    (