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


Python User.sherpa_users方法代码示例

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


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

示例1: list_albums

# 需要导入模块: from user.models import User [as 别名]
# 或者: from user.models.User import sherpa_users [as 别名]
def list_albums(request, album):
    albums = Album.objects.filter(parent=album).order_by("name")
    parents = []
    images = None
    current_album = None
    if album is not None:
        current_album = Album.objects.get(id=album)
        images = Image.objects.filter(album=album)
        parents = list_parents(current_album)

    fotokonkurranse_album = Fotokonkurranse.objects.get().album
    context = {
        "album": album,
        "albums": albums,
        "albumpath": parents,
        "current_album": current_album,
        "images": images,
        "origin": request.get_full_path(),
        "all_users": sorted(User.sherpa_users(), key=lambda u: u.get_first_name()),
        "current_navigation": "albums",
        "image_search_length": settings.IMAGE_SEARCH_LENGTH,
        "fotokonkurranse_album": fotokonkurranse_album,
        "album_download_part_count": Album.DOWNLOAD_PART_COUNT,
    }
    return render(request, "central/admin/images/list_albums.html", context)
开发者ID:Turistforeningen,项目名称:sherpa,代码行数:27,代码来源:views.py

示例2: search

# 需要导入模块: from user.models import User [as 别名]
# 或者: from user.models.User import sherpa_users [as 别名]
def search(request):
    context = {
        "origin": request.get_full_path(),
        "all_users": sorted(User.sherpa_users(), key=lambda u: u.get_first_name()),
    }
    if len(request.GET.get("q", "")) < settings.IMAGE_SEARCH_LENGTH:
        context.update({"too_short_query": True, "image_search_length": settings.IMAGE_SEARCH_LENGTH})
        return render(request, "central/admin/images/search.html", context)
    albums, images = full_archive_search(request.GET["q"])
    context.update({"albums": albums, "images": images, "search_query": request.GET["q"]})
    return render(request, "central/admin/images/search.html", context)
开发者ID:Turistforeningen,项目名称:sherpa,代码行数:13,代码来源:views.py

示例3: edit

# 需要导入模块: from user.models import User [as 别名]
# 或者: from user.models.User import sherpa_users [as 别名]
def edit(request, site, version):
    active_site = Site.objects.get(id=site)
    version = Version.objects.get(id=version)
    users = sorted(User.sherpa_users(), key=lambda u: u.get_first_name())
    context = {
        'active_site': active_site,
        'version': version,
        'users': users,
        'image_search_length': settings.IMAGE_SEARCH_LENGTH,
        'widget_data': admin_context(active_site),
    }
    context.update(url_picker_context(active_site))

    # Fake request.site to the edited site; this will make context processors behave accordingly
    request.site = active_site
    return render(request, 'common/admin/sites/articles/edit.html', context)
开发者ID:simensma,项目名称:sherpa,代码行数:18,代码来源:views.py

示例4: search

# 需要导入模块: from user.models import User [as 别名]
# 或者: from user.models.User import sherpa_users [as 别名]
def search(request):
    context = {
        'origin': request.get_full_path(),
        'all_users': sorted(User.sherpa_users(), key=lambda u: u.get_first_name())
    }
    if len(request.GET.get('q', '')) < settings.IMAGE_SEARCH_LENGTH:
        context.update({
            'too_short_query': True,
            'image_search_length': settings.IMAGE_SEARCH_LENGTH,
        })
        return render(request, 'common/admin/images/search.html', context)
    albums, images = full_archive_search(request.GET['q'])
    context.update({
        'albums': albums,
        'images': images,
        'search_query': request.GET['q']})
    return render(request, 'common/admin/images/search.html', context)
开发者ID:simensma,项目名称:sherpa,代码行数:19,代码来源:views.py

示例5: user_images

# 需要导入模块: from user.models import User [as 别名]
# 或者: from user.models.User import sherpa_users [as 别名]
def user_images(request, user):
    user = User.get_users().get(id=user)
    images = Image.objects.filter(uploader=user)
    if user == request.user:
        current_navigation = 'personal'
    else:
        current_navigation = ''

    context = {
        'active_user': user,
        'images': images,
        'origin': request.get_full_path(),
        'all_users': sorted(User.sherpa_users(), key=lambda u: u.get_first_name()),
        'current_navigation': current_navigation,
        'image_search_length': settings.IMAGE_SEARCH_LENGTH
    }
    return render(request, 'common/admin/images/user_images.html', context)
开发者ID:simensma,项目名称:sherpa,代码行数:19,代码来源:views.py

示例6: user_images

# 需要导入模块: from user.models import User [as 别名]
# 或者: from user.models.User import sherpa_users [as 别名]
def user_images(request, user):
    user = User.get_users(include_pending=True).get(id=user)
    images = Image.objects.filter(uploader=user)
    if user == request.user:
        current_navigation = "personal"
    else:
        current_navigation = ""

    context = {
        "active_user": user,
        "images": images,
        "origin": request.get_full_path(),
        "all_users": sorted(User.sherpa_users(), key=lambda u: u.get_first_name()),
        "current_navigation": current_navigation,
        "image_search_length": settings.IMAGE_SEARCH_LENGTH,
    }
    return render(request, "central/admin/images/user_images.html", context)
开发者ID:Turistforeningen,项目名称:sherpa,代码行数:19,代码来源:views.py

示例7: edit

# 需要导入模块: from user.models import User [as 别名]
# 或者: from user.models.User import sherpa_users [as 别名]
def edit(request, site, version):
    try:
        active_site = Site.get_cached_by_id(site)
        version = Version.objects.get(id=version)
        users = sorted(User.sherpa_users(), key=lambda u: u.get_first_name())
        context = {
            'active_site': active_site,
            'version': version,
            'users': users,
            'image_search_length': settings.IMAGE_SEARCH_LENGTH,
            'widget_data': admin_context(active_site),
            'category_choices': Article.CATEGORY_CHOICES,
        }
        context.update(url_picker_context(active_site))

        # Fake request.site to the edited site; this will make context processors behave accordingly
        request.site = active_site
        return render(request, 'central/admin/sites/articles/edit.html', context)
    except Version.DoesNotExist:
        messages.warning(request, 'article_does_not_exist')
        return redirect('admin:sites.articles.list', active_site.id)
开发者ID:,项目名称:,代码行数:23,代码来源:

示例8: image_details

# 需要导入模块: from user.models import User [as 别名]
# 或者: from user.models.User import sherpa_users [as 别名]
def image_details(request, image):
    image = Image.objects.get(id=image)
    parents = [] if image.album is None else list_parents(image.album)
    exif = json.loads(image.exif)
    try:
        taken = datetime.strptime(exif['DateTime'], '%Y:%m:%d %H:%M:%S')
    except Exception:
        taken = None
    tags = image.tags.all()
    context = {
        'image': image,
        'albumpath': parents,
        'exif': exif,
        'taken': taken,
        'tags': tags,
        'origin': request.get_full_path(),
        'all_users': sorted(User.sherpa_users(), key=lambda u: u.get_first_name()),
        'current_navigation': 'albums',
        'thumb_sizes': settings.THUMB_SIZES,
    }
    return render(request, 'common/admin/images/image_details.html', context)
开发者ID:simensma,项目名称:sherpa,代码行数:23,代码来源:views.py


注:本文中的user.models.User.sherpa_users方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。