当前位置: 首页>>代码示例>>Python>>正文


Python Photo.caption方法代码示例

本文整理汇总了Python中photos.models.Photo.caption方法的典型用法代码示例。如果您正苦于以下问题:Python Photo.caption方法的具体用法?Python Photo.caption怎么用?Python Photo.caption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在photos.models.Photo的用法示例。


在下文中一共展示了Photo.caption方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle

# 需要导入模块: from photos.models import Photo [as 别名]
# 或者: from photos.models.Photo import caption [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.caption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。