# Path: qiniuyun/backend.py
# class QiniuPush(QiniuStorage):
#     '''
#     根据settings中的QINIU_CONF配置七牛云的密钥、空间、域名等
#     直接调用该类的类方法即可进行文件上传、显示、删除
#     各方法的详细介绍见父类QiniuStorage
#     @auth:ZWJ
#     '''
#     def __init__(self):
#         super(QiniuPush,self).__init__(**settings.QINIU_CONF)
#             
#     @classmethod
#     def put_data(cls,name,data):
#         '''
#         上传内存中的文件流到七牛并返回上传后的url地址
#         example:
#             f=request.FILES['photo']
#             u.headImg=QiniuPush.put_data(f.name, f)
#             u.save() #保存到数据库
#             -----------------
#             #another def 
#             uuu = User.objects.get(username=request.session['user_name'])
#             uuu.headImg=QiniuPush.private_download_url(uuu.headImg) #生成 
#             return render(request, 'account/signup_result.html', {'user': uuu})
#         '''
#         qn=cls()
#         return super(QiniuPush,qn).put_data(name,data)
# 
#     @classmethod
#     def private_download_url(cls,url,expires=7200):
#         '''生成私有资源下载链接'''
#         qn=cls()
#         return super(QiniuPush,qn).private_download_url(url,expires)
#         
#     @classmethod            
#     def put_file(cls,filePath):
#         '''上传本地文件到七牛并返回上传后的url地址'''
#         qn=cls()
#         return super(QiniuPush,qn).put_file(filePath)
#         
#     @classmethod
#     def exists(cls,key):        
#         '''检测七牛云上是否有文件名为key的文件'''
#         qn=cls()
#         return super(QiniuPush,qn).exists(key)  
# 
#     @classmethod
#     def get_url(cls,key): 
#         '''返回七牛云上文件名为key的文件对应的url地址'''   
#         qn=cls()
#         return super(QiniuPush,qn).get_url(key)
#                 
#     @classmethod
#     def delete(cls,key):  
#         '''删除七牛云上文件名为key的文件'''
#         qn=cls()
#         return super(QiniuPush,qn).delete(key) 
#           
#     @classmethod
#     def ls_files(cls,prefix="", limit=100):
#         '''列出七牛云上的文件(前100个)'''
#         qn=cls()
#         return super(QiniuPush,qn).ls_files()
# 
# Path: qiniuyun/models.py
# class ImageAtQiniu(models.Model):
#     fullname = models.CharField(max_length=120,unique=True)
#     
#     def __unicode__(self):
#         return self.fullname
# 
# Path: DJangoHotel/viewspackage/indexView.py
# class ImgList(object):
#     def __init__(self,logo=None,k1=None,k2=None,k3=None):
#         self.logo=logo
#         self.key_home_1=k1
#         self.key_home_2=k2
#         self.key_home_3=k3
# 
# Path: DJangoHotel/models.py
# class Hotel(models.Model):
#     name = models.CharField(max_length=30,primary_key=True)
#     address = models.CharField(max_length=50)
#     description = models.TextField()
#     
#     def __unicode__(self):
#         return self.name  


from django.shortcuts import render
from qiniuyun.backend import QiniuPush
from qiniuyun.models import ImageAtQiniu
from .indexView import ImgList
from DJangoHotel.models import Hotel
# -*- coding: utf-8 -*-


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()

# Path: qiniuyun/backend.py
# class QiniuPush(QiniuStorage):
#     '''
#     根据settings中的QINIU_CONF配置七牛云的密钥、空间、域名等
#     直接调用该类的类方法即可进行文件上传、显示、删除
#     各方法的详细介绍见父类QiniuStorage
#     @auth:ZWJ
#     '''
#     def __init__(self):
#         super(QiniuPush,self).__init__(**settings.QINIU_CONF)
#             
#     @classmethod
#     def put_data(cls,name,data):
#         '''
#         上传内存中的文件流到七牛并返回上传后的url地址
#         example:
#             f=request.FILES['photo']
#             u.headImg=QiniuPush.put_data(f.name, f)
#             u.save() #保存到数据库
#             -----------------
#             #another def 
#             uuu = User.objects.get(username=request.session['user_name'])
#             uuu.headImg=QiniuPush.private_download_url(uuu.headImg) #生成 
#             return render(request, 'account/signup_result.html', {'user': uuu})
#         '''
#         qn=cls()
#         return super(QiniuPush,qn).put_data(name,data)
# 
#     @classmethod
#     def private_download_url(cls,url,expires=7200):
#         '''生成私有资源下载链接'''
#         qn=cls()
#         return super(QiniuPush,qn).private_download_url(url,expires)
#         
#     @classmethod            
#     def put_file(cls,filePath):
#         '''上传本地文件到七牛并返回上传后的url地址'''
#         qn=cls()
#         return super(QiniuPush,qn).put_file(filePath)
#         
#     @classmethod
#     def exists(cls,key):        
#         '''检测七牛云上是否有文件名为key的文件'''
#         qn=cls()
#         return super(QiniuPush,qn).exists(key)  
# 
#     @classmethod
#     def get_url(cls,key): 
#         '''返回七牛云上文件名为key的文件对应的url地址'''   
#         qn=cls()
#         return super(QiniuPush,qn).get_url(key)
#                 
#     @classmethod
#     def delete(cls,key):  
#         '''删除七牛云上文件名为key的文件'''
#         qn=cls()
#         return super(QiniuPush,qn).delete(key) 
#           
#     @classmethod
#     def ls_files(cls,prefix="", limit=100):
#         '''列出七牛云上的文件(前100个)'''
#         qn=cls()
#         return super(QiniuPush,qn).ls_files()
# 
# Path: qiniuyun/models.py
# class ImageAtQiniu(models.Model):
#     fullname = models.CharField(max_length=120,unique=True)
#     
#     def __unicode__(self):
#         return self.fullname
# 
# Path: DJangoHotel/viewspackage/indexView.py
# class ImgList(object):
#     def __init__(self,logo=None,k1=None,k2=None,k3=None):
#         self.logo=logo
#         self.key_home_1=k1
#         self.key_home_2=k2
#         self.key_home_3=k3
# 
# Path: DJangoHotel/models.py
# class Hotel(models.Model):
#     name = models.CharField(max_length=30,primary_key=True)
#     address = models.CharField(max_length=50)
#     description = models.TextField()
#     
#     def __unicode__(self):
#         return self.name  


# Path: DJangoHotel/viewspackage/aboutView.py
from django.shortcuts import render
from qiniuyun.backend import QiniuPush
from qiniuyun.models import ImageAtQiniu
from .indexView import ImgList
from DJangoHotel.models import Hotel

# -*- coding: utf-8 -*-


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]