예제 #1
0
파일: common.py 프로젝트: CaptainBerg/me
 def create_photo_with_url(cls, url, real_file, mime,  **settings):
     dbphoto = DBPhoto.create(url=url, mime=mime, real_file=real_file)
     dbphoto.save()
     _ = dbphoto.stats  # init stats
     photo = cls(dbphoto)
     photo.update(**settings)
     return photo
예제 #2
0
 def create_photo_with_url(cls, url, real_file, mime,  **settings):
     dbphoto = DBPhoto.create(url=url, mime=mime, real_file=real_file)
     dbphoto.save()
     _ = dbphoto.stats  # init stats
     photo = cls(dbphoto)
     photo.update(**settings)
     return photo
예제 #3
0
 def create_photo(cls, binary, **settings):
     url, real_file, url_thumb, real_file_thumb, mime = save_photo(binary, settings['file_name'])
     dbphoto = DBPhoto.create(url=url, mime=mime, real_file=real_file)
     dbphoto.url_thumb = url_thumb
     dbphoto.real_file_thumb = real_file_thumb
     dbphoto.save()
     _ = dbphoto.stats  # init stats
     photo = cls(dbphoto)
     photo.update(**settings)
     return photo
예제 #4
0
파일: common.py 프로젝트: errorcode7/me
 def create_photo(cls, binary, **settings):
     url, real_file, url_thumb, real_file_thumb, mime = save_photo(binary)
     dbphoto = DBPhoto.create(url=url, mime=mime, real_file=real_file)
     dbphoto.url_thumb = url_thumb
     dbphoto.real_file_thumb = real_file_thumb
     dbphoto.save()
     _ = dbphoto.stats  # init stats
     photo = cls(dbphoto)
     photo.update(**settings)
     return photo
예제 #5
0
 def hot_photos(cls, count=12, order="like_count desc"):
     return DBPhoto.hot_photos(count, order)
예제 #6
0
 def get_by_id(cls, id):
     dbphoto = DBPhoto.get_by_id(id)
     return dbphoto and cls(dbphoto)
예제 #7
0
파일: common.py 프로젝트: errorcode7/me
 def hot_photos(cls, count=12, order="like_count desc"):
     return DBPhoto.hot_photos(count, order)
예제 #8
0
파일: common.py 프로젝트: errorcode7/me
 def get_by_id(cls, id):
     dbphoto = DBPhoto.get_by_id(id)
     return dbphoto and cls(dbphoto)