# Path: qiniuyun/views.py
# class UploadForm(forms.Form):
# class Img(object):
# def upload(request):
# def upload_result(request):
#     def __init__(self,name,url):
# def show_imgs(request):
#     L=[Img(i.fullname,QP.private_download_url(i.fullname)) for i in imgs]
# 
# Path: DJangoHotel/viewspackage/aboutView.py
# def about(request):
#     title='DJango Hotel'
#     hotel=Hotel.objects.get(name='DJango Hotel')
#     name=hotel.name
#     description=hotel.description
#     address=hotel.address
# 
#     imgObjs=ImageAtQiniu.objects.all()
#     imgUrls=[QiniuPush.private_download_url(i.fullname) for i in imgObjs]
#     imgs=ImgList()
#     
#     for i in imgUrls:        
#         if 'hotel-logo' in i:
#             imgs.logo=i
# 
#     return render(request,'about.html',{
#         'title':title,
#         'name':name,
#         'description':description,
#         'address':address,
#         'img':imgs,
#     })
# 
# Path: DJangoHotel/viewspackage/indexView.py
# def index(request):
#     hotel=Hotel.objects.get(name='DJango Hotel')
#     description=hotel.description
#     
#     imgObjs=ImageAtQiniu.objects.all()
#     imgUrls=[QiniuPush.private_download_url(i.fullname) for i in imgObjs]
#     imgs=ImgList()
#     
#     for i in imgUrls:        
#         if 'hotel-logo' in i:
#             imgs.logo=i            
#         elif 'key_home_1' in i:
#             imgs.key_home_1=i
#         elif 'key_home_2' in i:
#             imgs.key_home_2=i
#         elif 'key_home_3' in i:
#             imgs.key_home_3=i
# 
#     return render(request,'index.html',{'description':description,'img':imgs})
# 
# Path: DJangoHotel/viewspackage/orderResultView.py
# def orderResult(request):
#     imgObjs=ImageAtQiniu.objects.all()
#     imgUrls=[QiniuPush.private_download_url(i.fullname) for i in imgObjs]
#     imgs=ImgList()
#     
#     for i in imgUrls:        
#         if 'hotel-logo' in i:
#             imgs.logo=i
#                 
#     tel,name,IDcard= request.GET['tel'],request.GET['name'],request.GET['IDcard']
#     if Customer.objects.all():
#         cc=Customer.objects.filter(IDcard=IDcard)
#     else:
#         cc=[]
#     for c in cc:
#         if c and c.tel==tel and c.name==name:
#             tempCustomer=c
#             break
#     else:
#         tempCustomer=Customer(tel=tel,name=name,IDcard=IDcard)        
#         tempCustomer.save()
# 
#     tempOrder=Order()
#     tempOrder.customer = tempCustomer
#     tempOrder.roomtype = request.GET['roomtype']
#     
#     
#     begin,end = request.GET['begin'],request.GET['end']     
#     tempOrder.begin = (datetime.datetime.strptime(begin , '%Y-%m-%d')).date()
#     tempOrder.end = (datetime.datetime.strptime(end , '%Y-%m-%d')).date()
#     period = (tempOrder.end - tempOrder.begin).days 
#     if period==0:period=1        
#         
#     price = 0
# 
#     if tempOrder.roomtype == 'standard':
#         price = (RoomInfo.objects.get(name='标准间')).price
# 
#     elif tempOrder.roomtype =='better':
#         price = (RoomInfo.objects.get(name='豪华间')).price
# 
#     elif tempOrder.roomtype =='president':
#         price = (RoomInfo.objects.get(name='总统间')).price
# 
#     tempOrder.roomnum=randint(1,10)
#     tempOrder.totalprice = period * price
#     tempOrder.save()
# 
# 
#     return render(request,'orderresult.html',{'order':tempOrder,'img':imgs})
# 
# Path: DJangoHotel/viewspackage/orderView.py
# def order(request):
#     imgObjs=ImageAtQiniu.objects.all()
#     imgUrls=[QiniuPush.private_download_url(i.fullname) for i in imgObjs]
#     imgs=ImgList()
#     
#     for i in imgUrls:        
#         if 'hotel-logo' in i:
#             imgs.logo=i
# 
#     return render(request,'order.html',{'img':imgs})
# 
# Path: DJangoHotel/viewspackage/roomInfoView.py
# def roomInfo(request):
#     rooms=RoomInfo.objects.all()
#     imgObjs=ImageAtQiniu.objects.all()
#     imgUrls=[QiniuPush.private_download_url(i.fullname) for i in imgObjs]
#     imgs=ImgList()
#     
#     for i in imgUrls:        
#         if 'hotel-logo' in i:
#             imgs.logo=i
#                 
#     return render(request,'roominfo.html',{'roomInfoList':rooms,'img':imgs})


from django.conf.urls import include, url
from django.contrib import admin
from qiniuyun import views as qiniuyun_views
from DJangoHotel.viewspackage.aboutView import about
from DJangoHotel.viewspackage.indexView import index
from DJangoHotel.viewspackage.orderResultView import orderResult
from DJangoHotel.viewspackage.orderView import order
from DJangoHotel.viewspackage.roomInfoView import roomInfo
from django.conf import settings
from django.conf.urls.static import static
from django.views.generic.base import RedirectView


urlpatterns = [
    # Examples:
    # url(r'^$', 'kcsj.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),
    #url(r'^$', RedirectView.as_view(url='/upload/', permanent=True),name='home'),
    url(r'^upload/$', qiniuyun_views.upload, name='upload'),
    url(r'^upload/done/$', qiniuyun_views.upload_result, name='upload_done'),
    url(r'^images/$', qiniuyun_views.show_imgs, name='show_imgs'),

    url(r'^admin/', include(admin.site.urls)),

# Path: qiniuyun/views.py
# class UploadForm(forms.Form):
# class Img(object):
# def upload(request):
# def upload_result(request):
#     def __init__(self,name,url):
# def show_imgs(request):
#     L=[Img(i.fullname,QP.private_download_url(i.fullname)) for i in imgs]
# 
# Path: DJangoHotel/viewspackage/aboutView.py
# def about(request):
#     title='DJango Hotel'
#     hotel=Hotel.objects.get(name='DJango Hotel')
#     name=hotel.name
#     description=hotel.description
#     address=hotel.address
# 
#     imgObjs=ImageAtQiniu.objects.all()
#     imgUrls=[QiniuPush.private_download_url(i.fullname) for i in imgObjs]
#     imgs=ImgList()
#     
#     for i in imgUrls:        
#         if 'hotel-logo' in i:
#             imgs.logo=i
# 
#     return render(request,'about.html',{
#         'title':title,
#         'name':name,
#         'description':description,
#         'address':address,
#         'img':imgs,
#     })
# 
# Path: DJangoHotel/viewspackage/indexView.py
# def index(request):
#     hotel=Hotel.objects.get(name='DJango Hotel')
#     description=hotel.description
#     
#     imgObjs=ImageAtQiniu.objects.all()
#     imgUrls=[QiniuPush.private_download_url(i.fullname) for i in imgObjs]
#     imgs=ImgList()
#     
#     for i in imgUrls:        
#         if 'hotel-logo' in i:
#             imgs.logo=i            
#         elif 'key_home_1' in i:
#             imgs.key_home_1=i
#         elif 'key_home_2' in i:
#             imgs.key_home_2=i
#         elif 'key_home_3' in i:
#             imgs.key_home_3=i
# 
#     return render(request,'index.html',{'description':description,'img':imgs})
# 
# Path: DJangoHotel/viewspackage/orderResultView.py
# def orderResult(request):
#     imgObjs=ImageAtQiniu.objects.all()
#     imgUrls=[QiniuPush.private_download_url(i.fullname) for i in imgObjs]
#     imgs=ImgList()
#     
#     for i in imgUrls:        
#         if 'hotel-logo' in i:
#             imgs.logo=i
#                 
#     tel,name,IDcard= request.GET['tel'],request.GET['name'],request.GET['IDcard']
#     if Customer.objects.all():
#         cc=Customer.objects.filter(IDcard=IDcard)
#     else:
#         cc=[]
#     for c in cc:
#         if c and c.tel==tel and c.name==name:
#             tempCustomer=c
#             break
#     else:
#         tempCustomer=Customer(tel=tel,name=name,IDcard=IDcard)        
#         tempCustomer.save()
# 
#     tempOrder=Order()
#     tempOrder.customer = tempCustomer
#     tempOrder.roomtype = request.GET['roomtype']
#     
#     
#     begin,end = request.GET['begin'],request.GET['end']     
#     tempOrder.begin = (datetime.datetime.strptime(begin , '%Y-%m-%d')).date()
#     tempOrder.end = (datetime.datetime.strptime(end , '%Y-%m-%d')).date()
#     period = (tempOrder.end - tempOrder.begin).days 
#     if period==0:period=1        
#         
#     price = 0
# 
#     if tempOrder.roomtype == 'standard':
#         price = (RoomInfo.objects.get(name='标准间')).price
# 
#     elif tempOrder.roomtype =='better':
#         price = (RoomInfo.objects.get(name='豪华间')).price
# 
#     elif tempOrder.roomtype =='president':
#         price = (RoomInfo.objects.get(name='总统间')).price
# 
#     tempOrder.roomnum=randint(1,10)
#     tempOrder.totalprice = period * price
#     tempOrder.save()
# 
# 
#     return render(request,'orderresult.html',{'order':tempOrder,'img':imgs})
# 
# Path: DJangoHotel/viewspackage/orderView.py
# def order(request):
#     imgObjs=ImageAtQiniu.objects.all()
#     imgUrls=[QiniuPush.private_download_url(i.fullname) for i in imgObjs]
#     imgs=ImgList()
#     
#     for i in imgUrls:        
#         if 'hotel-logo' in i:
#             imgs.logo=i
# 
#     return render(request,'order.html',{'img':imgs})
# 
# Path: DJangoHotel/viewspackage/roomInfoView.py
# def roomInfo(request):
#     rooms=RoomInfo.objects.all()
#     imgObjs=ImageAtQiniu.objects.all()
#     imgUrls=[QiniuPush.private_download_url(i.fullname) for i in imgObjs]
#     imgs=ImgList()
#     
#     for i in imgUrls:        
#         if 'hotel-logo' in i:
#             imgs.logo=i
#                 
#     return render(request,'roominfo.html',{'roomInfoList':rooms,'img':imgs})


# Path: kcsj/urls.py
from django.conf.urls import include, url
from django.contrib import admin
from qiniuyun import views as qiniuyun_views
from DJangoHotel.viewspackage.aboutView import about
from DJangoHotel.viewspackage.indexView import index
from DJangoHotel.viewspackage.orderResultView import orderResult
from DJangoHotel.viewspackage.orderView import order
from DJangoHotel.viewspackage.roomInfoView import roomInfo
from django.conf import settings
from django.conf.urls.static import static
from django.views.generic.base import RedirectView



urlpatterns = [
    # Examples:
    # url(r'^$', 'kcsj.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),
    #url(r'^$', RedirectView.as_view(url='/upload/', permanent=True),name='home'),
    url(r'^upload/$', qiniuyun_views.upload, name='upload'),
    url(r'^upload/done/$', qiniuyun_views.upload_result, name='upload_done'),
    url(r'^images/$', qiniuyun_views.show_imgs, name='show_imgs'),

    url(r'^admin/', include(admin.site.urls)),

    url(r'^about/', about),