當前位置: 首頁>>代碼示例>>Python>>正文


Python Photo.image方法代碼示例

本文整理匯總了Python中photos.models.Photo.image方法的典型用法代碼示例。如果您正苦於以下問題:Python Photo.image方法的具體用法?Python Photo.image怎麽用?Python Photo.image使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在photos.models.Photo的用法示例。


在下文中一共展示了Photo.image方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: handle

# 需要導入模塊: from photos.models import Photo [as 別名]
# 或者: from photos.models.Photo import image [as 別名]
    def handle(self, *args, **options):

        journalist_group, created = Group.objects.get_or_create(name="Journalists")
        if created:
            journalist_group.permissions.add(
                # jaam.act
                Permission.objects.get(codename="add_act"),
                Permission.objects.get(codename="change_act"),
                Permission.objects.get(codename="delete_act"),
                # jaam.blog
                Permission.objects.get(codename="add_blog"),
                Permission.objects.get(codename="change_blog"),
                Permission.objects.get(codename="delete_blog"),
                Permission.objects.get(codename="add_blogpost"),
                Permission.objects.get(codename="change_blogpost"),
                Permission.objects.get(codename="delete_blogpost"),
                # jaam.journalism
                Permission.objects.get(codename="add_tag"),
                Permission.objects.get(codename="change_tag"),
                Permission.objects.get(codename="delete_tag"),
                Permission.objects.get(codename="add_userprofile"),
                Permission.objects.get(codename="change_userprofile"),
                Permission.objects.get(codename="delete_userprofile"),
                # jaam.photos
                Permission.objects.get(codename="add_photo"),
                Permission.objects.get(codename="change_photo"),
                Permission.objects.get(codename="delete_photo"),
                Permission.objects.get(codename="add_photogallery"),
                Permission.objects.get(codename="change_photogallery"),
                Permission.objects.get(codename="delete_photogallery"),
                Permission.objects.get(codename="add_photogalleryitem"),
                Permission.objects.get(codename="change_photogalleryitem"),
                Permission.objects.get(codename="delete_photogalleryitem"),
                # jaam.projects
                Permission.objects.get(codename="add_project"),
                Permission.objects.get(codename="change_project"),
                Permission.objects.get(codename="delete_project"),
                Permission.objects.get(codename="add_projectlocation"),
                Permission.objects.get(codename="change_projectlocation"),
                Permission.objects.get(codename="delete_projectlocation"),
                # jaam.stories
                Permission.objects.get(codename="add_story"),
                Permission.objects.get(codename="change_story"),
                Permission.objects.get(codename="delete_story"),
                # jaa.videos
                Permission.objects.get(codename="add_video"),
                Permission.objects.get(codename="change_video"),
                Permission.objects.get(codename="delete_video"),
                Permission.objects.get(codename="add_videogallery"),
                Permission.objects.get(codename="change_videogallery"),
                Permission.objects.get(codename="delete_videogallery"),
                Permission.objects.get(codename="add_videogalleryitem"),
                Permission.objects.get(codename="change_videogalleryitem"),
                Permission.objects.get(codename="delete_videogalleryitem"),
                # comments
                Permission.objects.get(codename="add_comment"),
                Permission.objects.get(codename="change_comment"),
                Permission.objects.get(codename="delete_comment"),
                Permission.objects.get(codename="add_commentflag"),
                Permission.objects.get(codename="change_commentflag"),
                Permission.objects.get(codename="delete_commentflag"),
                Permission.objects.get(codename="can_moderate"),
                # doccloud
                Permission.objects.get(codename="add_document"),
                Permission.objects.get(codename="change_document"),
                Permission.objects.get(codename="delete_document"),
                Permission.objects.get(codename="add_documentcloudproperties"),
                Permission.objects.get(codename="change_documentcloudproperties"),
                Permission.objects.get(codename="delete_documentcloudproperties"),
            )

        try:
            User.objects.get(username="Default")
        except User.DoesNotExist:
            default_journalist = User()
            default_journalist.username = "Default"
            default_journalist.save()
            default_journalist.groups.add(Group.objects.get(name="Journalists"))
            default_journalist.save()

        try:
            Project.all_objects.get(slug="default")
        except Project.DoesNotExist:
            default_project = Project()
            default_project.title = "Default"
            default_project.slug = "default"
            default_project.tagline = "The default project"
            default_project.image = 0
            default_project.save()

        try:
            Photo.all_objects.get(slug="default")
        except Photo.DoesNotExist:
            default_photo = Photo()
            default_photo.project = Project.all_objects.get(slug="default")
            default_photo.title = "Default"
            default_photo.slug = "default"
            default_photo.caption = "The default photo"
            default_photo.journalist = User.objects.get(username="Default")
            default_photo.image = "http://i.imgur.com/uxRkD.jpg"
#.........這裏部分代碼省略.........
開發者ID:CoJMC,項目名稱:jaam,代碼行數:103,代碼來源:initializeproject.py


注:本文中的photos.models.Photo.image方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。