
    h-                     .   d dl mZ d dlZd dlmZmZ d dlmZ  G d de      Z G d de      Z	 G d	 d
ej                        Z G d dej                        Z G d dej                        Z G d dej                        Z G d dej                        Z G d dej                        Z G d dej                        Z G d dej                        Z G d dej                        Z G d dej                        Z G d dej                        Zy)    )modelsN)AbstractBaseUserBaseUserManager)settingsc                       e Zd ZddZddZy)UserManagerNc                     |st        d      |st        d      | j                  |      } | j                  d||d|}|j                  |       |j	                  | j
                         |S )NzThe Username field is requiredzThe Email field is required)usernameemail)using )
ValueErrornormalize_emailmodelset_passwordsave_db)selfr
   r   passwordextra_fieldsusers         7/var/www/html/janka_web_project/janka_web_app/models.pycreate_userzUserManager.create_user	   so    =>>:;;$$U+tzzI85ILI(#			!    c                 P    |j                  dd        | j                  |||fi |S )N	user_roleadmin)
setdefaultr   )r   r
   r   r   r   s        r   create_superuserzUserManager.create_superuser   s.    W5t%J\JJr   N)__name__
__module____qualname__r   r   r   r   r   r   r      s    
Kr   r   c                      e Zd Zg dZ ej
                  dej                  d      Z ej                  d      Z
 ej                  dd      Z ej                         Z ej                  d	dd
      Z ej                  dd      Z ej                  ded      Z ej$                  d      Z ej(                  dd      Z ej,                  d      Z ej,                  d      Z e       ZdZdgZd Zy)User)r   Adminr   r%   ownerOwnerTF)primary_keydefaulteditable   
max_lengthd   r1   unique   r1   blanknullr7   r8   
   r   r1   choicesr-   auto_now_addzprofile_pics/zprofile_pics/default.gif)	upload_tor-   r-   r
   r   c                     | j                   S r    )r
   r   s    r   __str__zUser.__str__3   s    }}r   N)r!   r"   r#   ROLE_CHOICESr   	UUIDFielduuiduuid4id	CharField	full_namer
   
EmailFieldr   phone	TextFieldaddressr   DateTimeField
created_at
ImageFieldprofile_pictureBooleanField	is_activeis_staffr   objectsUSERNAME_FIELDREQUIRED_FIELDSrC   r   r   r   r%   r%      s    L
 
		dDJJ	OB   C0Iv3t<HFEF$TBEfT5G   BfUI%%%48J'f''/KefO $##D1I"v""51HmGNiOr   r%   c                      e Zd Zg dZg dZ ej                  d      Z ej                         Z	 ej                  ded      Z
 ej                  ded      Z ej                  d	
      Z ej                  dddd      Z ej                  d      Z ej                  d      Z ej$                  eej(                  ddd      Z ej                  dddd      Z G d d      Zd Zy)Notification))
user_eventz
User Event)system_alertzSystem Alert)generalGeneral)r(   r&   r)   r/   r0   2   r]   r;   r   Fr@   r   T)r1   r-   r8   r7   r=   )auto_nownotifications_received)	on_deleter8   r7   related_namei  z)URL to go to when notification is clicked)r1   r8   r7   	help_textc                       e Zd ZdgZdZy)Notification.Meta-created_atnotificationsN)r!   r"   r#   orderingdb_tabler   r   r   Metarf   Q   s    !?"r   rk   c                     | j                    d| j                  j                          d| j                  j                   S )N    → z | By: )titlerole_visibilityupper
created_byr
   rB   s    r   rC   zNotification.__str__U   s8    **U4#7#7#=#=#?"@H`H`Gabbr   N)r!   r"   r#   CATEGORY_CHOICESrD   r   rI   rn   rM   messagecategoryro   rS   	is_viewedrq   rO   rP   
updated_at
ForeignKeyr%   CASCADErecipient_user
action_urlrk   rC   r   r   r   rZ   rZ   6   s   
L F,Ef Gv27GQZ[H&f&&"lT[\O###E2I!!!RdRVWJ%%%48J%%%t4J&V&&tv~~DX\  lD  EN!!!=	J# #cr   rZ   c                       e Zd Z ej                  d      Z ej                  d      Z ej                  d      Z	d Z
y)	DzongkhagTr,   r2   r0   r=   c                     | j                   S r    namerB   s    r   rC   zDzongkhag.__str__^       yyr   N)r!   r"   r#   r   	AutoFielddzo_idrI   r   rO   rP   rC   r   r   r   r|   r|   Y   s=    V$/F6s+D%%%48Jr   r|   c                       e Zd Z ej                  d      Z ej                  d      Z ej                  e	ej                  d      Z ej                  d      Zd Zy	)
GewogTr}   r2   r0   gewogsrb   rc   r=   c                 N    | j                    d| j                  j                    dS N ())r   	dzongkhagrB   s    r   rC   zGewog.__str__h   s$    ))Bt~~223155r   N)r!   r"   r#   r   r   gewog_idrI   r   rw   r|   rx   r   rO   rP   rC   r   r   r   r   r   b   sX    vD1H6s+D!!!)v~~T\]I%%%48J6r   r   c                       e Zd Z ej                  d      Z ej                  d      Z ej                  e	ej                  d      Z ej                  eej                  d      Z ej                  d      Zd Zy	)
VillageTr}   r2   r0   villagesr   r=   c                 z    | j                    d| j                  j                    d| j                  j                    S )N - z, )r   gewogr   rB   s    r   rC   zVillage.__str__r   s1    ))C

04>>3F3F2GHHr   N)r!   r"   r#   r   r   
village_idrI   r   rw   r|   rx   r   r   r   rO   rP   rC   r   r   r   r   r   l   ss    !!!d3J6s+D!!!)v~~T^_IFev~~JWE%%%48JIr   r   c                   V   e Zd Z ej                  d      Z ej                  d      Z ej                  dd      Z ej                  e
ej                  dd      Z ej                  eej                  dd      Z ej                  eej                  dd      Z ej                  d      Z ej$                  dd      Z ej(                  dddd	
      Z ej(                  dddd	
      Z ej(                  dddd	
      Z ej(                  dddd	
      Z ej2                  d      Z ej2                  d      Z ej                  ddd      Z ej:                  d      ZdZ ej                  ded      Z  ej                  e!ejD                  ddd      Z#d Z$d Z%y)Hotelr/   r0   Tr9   hotels)rb   r8   rc      zhotels/hotels/default_hotel.jpgr?   r7   r8   r-   r   r@   r6   r=   	)singlezSingle Room)doublezDouble Room)twinz	Twin Room)triplezTriple Room)quadz	Quad Room)queenz
Queen Room)kingz	King Room)suiteSuite)	penthouse	PenthouseActiver;   rb   rc   r8   r7   c                     | j                   | j                  | j                  | j                  g}|D cg c]  }|st	        |d      s| c}S c c}w )Nurl)
home_imagehotel_image1hotel_image2hotel_image3hasattr)r   imagesimgs      r   get_gallery_imageszHotel.get_gallery_images   sI    //4#4#4d6G6GIZIZ[%Eve1DvEEEs   AAAc                     | j                   S r    r   rB   s    r   rC   zHotel.__str__   r   r   N)&r!   r"   r#   r   rI   r   locationrM   descriptionrw   r|   SET_NULLr   r   r   r   villagecontact_numberrK   r   rQ   r   r   r   r   PositiveIntegerFieldtotal_roomsavailable_roomshotel_ownerrO   rP   room_choices
room_typesr%   rx   r   r   rC   r   r   r   r   r   u   s   6s+Dv3/H"&""D9K!!!)vT`hiIFevTX`aEf6??\deG%V%%4NFDt4E"""YdWqrJ$6$$y4YstL$6$$y4YstL$6$$y4YstL-&--a8K1f11!<O"&""cDIK%%%48J
L "!!RxXJ6TV^^(Y]eijDFr   r   c                   H   e Zd ZdZ ej
                  dej                  d      Z ej                  ded      Z	 ej                  dd	      Z ej                  d
dd      Z ej                  d      Z ej                   d      Z ej$                  dddd      Zd Zy)RoomTyper   r   hotel_room_typesr   r   r   r;   Tr9   r:      r   )
max_digitsdecimal_placesr-      r@   r=   zroom_types/r   r   c                 V    | j                          d| j                  j                   dS r   )get_room_type_displayhotelr   rB   s    r   rC   zRoomType.__str__   s(    ,,./r$**//1B!DDr   N)r!   r"   r#   ROOM_CHOICESr   rw   rx   r   rI   	room_typerM   r   DecimalFieldprice_per_nightr   r   rO   rP   rQ   
room_imagerC   r   r   r   r   r      s    
L FgN`aE   BhWI"&""D9K)f))RSTUO-&--a8K%%%48J"""]$T[uvJEr   r   c                      e Zd Z ej                  eej                  d      Z ej                  eej                  d      Z	 ej                  e
ej                  ddd      Z ej                         Z ej                         Z ej                  d      Z ej                  d      Z ej$                  d      ZdZ ej*                  d	ed
      Zd Zy)Bookingbookingsr   Tr   r   r@   r=   ))pendingPending)	confirmed	Confirmed)	cancelled	Cancelledr   r   r;   c                 |    | j                   j                   d| j                  j                   d| j                   dS )Nr   r   r   )r   r
   r   r   statusrB   s    r   rC   zBooking.__str__   s3    ))$$%S(9DKK=JJr   N)r!   r"   r#   r   rw   r   rx   r   r%   r   r   room_selected	DateFieldcheck_in	check_outr   number_of_roomsnumber_of_guestsrO   rP   status_choicesrI   r   rC   r   r   r   r   r      s    Fev~~JWE6TV^^*UD%F%%..M  v!H   "I1f11!<O2v221=%%%48JN
 V^YWFKr   r   c                   :   e Zd Z ej                  eej                  d      Z ej                  eej                  d      Z ej                  ddd      Z
 ej                         Z ej                  d      Z ej                  d	      Zd
 Z G d d      Zy)Messagesent_messagesr   received_messages   Tr6   Fr@   r=   c                     d| j                   j                   d| j                  j                   d| j                  xs | j                  d d  S )NzFrom z to z:    )senderr
   receiversubjectrs   rB   s    r   rC   zMessage.__str__   sK    t{{++,D1G1G0H4<<Kl[_[g[ghkik[lJmnnr   c                       e Zd ZdgZy)Message.Metarg   Nr!   r"   r#   ri   r   r   r   rk   r      s	    !?r   rk   N)r!   r"   r#   r   rw   r%   rx   r   r   rI   r   rM   rs   rS   readrO   rP   rC   rk   r   r   r   r   r      s    Vtv~~O\F v  NabHf#TEGf G6u-D%%%48Jo# #r   r   c                      e Zd Z ej                  eej                  d      Z ej                  eej                  ddd      Z	 ej                  e
ej                  d      Z ej                  eej                  ddd      Z ej                   edd      D  cg c]  }|t!        |      f c}}} d      Z ej$                  dd	      Z ej(                  d
      Z G d d      Zd Zyc c}}} w )Reviewreviewsr   Tr   r         )r<   r-   r9   r=   c                       e Zd ZdgZdZddgZy)Review.Metarg   r   r   bookingN)r!   r"   r#   ri   rj   unique_togetherr   r   r   rk   r      s    !?!9-r   rk   c                 |    | j                   j                   d| j                  j                   d| j                   dS )Nrm   r   u   ★))r   r
   r   r   ratingrB   s    r   rC   zReview.__str__   s3    ))$$%U4::??*;2dkk]$OOr   N)r!   r"   r#   r   rw   r   rx   r   r   r   r%   r   r   r   PositiveSmallIntegerFieldrangestrr   rM   commentrO   rP   rk   rC   ).0ir   s   000r   r   r      s    Fev~~IVE!!!(fnnS\cgostI6TV^^)TDf6>>PY`dlpqG-V--&+Aqk2k!SVk2F fT5G%%%48J. .
P 3s   C2r   c                        e Zd Z ej                  dd      Z ej                  ddd      Z ej                  d      Z	 G d d      Z
d Z fd	Z xZS )
GalleryCategoryr_   Tr3   )r1   r4   r7   r7   c                       e Zd ZdZdgZy)GalleryCategory.MetazGallery Categoriesr   N)r!   r"   r#   verbose_name_pluralri   r   r   r   rk   r     s    28r   rk   c                     | j                   S r    r   rB   s    r   rC   zGalleryCategory.__str__   r   r   c                 v    | j                   sddlm}  || j                        | _         t	        |   |i | y )Nr   )slugify)slugdjango.utils.textr  r   superr   )r   argskwargsr  	__class__s       r   r   zGalleryCategory.save   s.    yy1		*DId%f%r   )r!   r"   r#   r   rI   r   	SlugFieldr  rM   r   rk   rC   r   __classcell__)r  s   @r   r   r      sX    6r$7D6r$dCD"&"".K & &r   r   c                       e Zd Z ej                  d      Z ej                  d      Z ej                  e	ej                  d      Z ej                  d      Z ej                  d	      Z G d
 d      Zd Zy)GalleryImager2   r0   Tr  r   r   zgallery_images/)r?   r=   c                       e Zd ZdgZy)GalleryImage.Metaz-uploaded_atNr   r   r   r   rk   r    s
    "#r   rk   c                     | j                   S r    )rn   rB   s    r   rC   zGalleryImage.__str__  s    zzr   N)r!   r"   r#   r   rI   rn   rM   r   rw   r   rx   rt   rQ   imagerO   uploaded_atrk   rC   r   r   r   r  r    su    F,E"&"".K v  FNNYabHF(9:E&&&&D9K$ $r   r  )	django.dbr   rF   django.contrib.auth.modelsr   r   django.confr   r   r%   ModelrZ   r|   r   r   r   r   r   r   r   r   r  r   r   r   <module>r     s      H  K/ K$ 8 c6<<  cF 6FLL 6Ifll I#FLL #JEv|| E2Kfll K2#fll #PV\\ P*&fll &$6<< r   