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


Python Member.get_by_card_str方法代码示例

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


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

示例1: kiosk_identify_subject

# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import get_by_card_str [as 别名]
def kiosk_identify_subject(request, staff_card_str, next_url):

    member = Member.get_by_card_str(staff_card_str)
    if member is None or not member.is_domain_staff():
        return render(request, 'members/kiosk-invalid-card.html', {})  # TODO: use kiosk-domain-error template?

    params = {
        "staff_card_str" : staff_card_str,
        "next_url" : next_url
    }
    return render(request, 'members/kiosk-identify-subject.html', params)
开发者ID:adrianboyko,项目名称:xerocraft-django,代码行数:13,代码来源:views.py

示例2: kiosk_staff_menu

# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import get_by_card_str [as 别名]
def kiosk_staff_menu(request, member_card_str):

    member = Member.get_by_card_str(member_card_str)
    if member is None or not member.is_domain_staff():
        return render(request, 'members/kiosk-invalid-card.html', {})  # TODO: use kiosk-domain-error template?

    params = {
        "memb_fname" : member.first_name,
        "memb_card_str" : member_card_str
    }
    return render(request, 'members/kiosk-staff-menu.html', params)
开发者ID:adrianboyko,项目名称:xerocraft-django,代码行数:13,代码来源:views.py

示例3: _log_visit_event

# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import get_by_card_str [as 别名]
def _log_visit_event(member_card_str, event_type):

    is_valid_evt = event_type in [x for (x, _) in VisitEvent.VISIT_EVENT_CHOICES]
    if not is_valid_evt:
        return False, "Invalid event type."

    member = Member.get_by_card_str(member_card_str)
    if member is None:
        return False, "No matching member found."
    else:
        VisitEvent.objects.create(who=member, event_type=event_type)
        _inform_other_systems_of_checkin(member, event_type)
        return True, member
开发者ID:adrianboyko,项目名称:xerocraft-django,代码行数:15,代码来源:views.py

示例4: api_member_details_pub

# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import get_by_card_str [as 别名]
def api_member_details_pub(request, member_card_str):
    """ Respond with corresponding user/member tags given the membership card string. """

    subject = Member.get_by_card_str(member_card_str)

    if subject is None:
        return JsonResponse({'error':"Invalid member card string"})

    data = {
        'pk': subject.pk,
        'is_active': subject.is_active,
        'tags': [tag.name for tag in subject.tags.all()]
    }
    return JsonResponse(data)
开发者ID:adrianboyko,项目名称:xerocraft-django,代码行数:16,代码来源:views.py

示例5: kiosk_main_menu

# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import get_by_card_str [as 别名]
def kiosk_main_menu(request, member_card_str):
    member = Member.get_by_card_str(member_card_str)

    if member is None:
        return render(request, 'members/kiosk-invalid-card.html', {})  # TODO: use kiosk-domain-error template?

    params = {
        "memb_fname"    : member.first_name,
        "memb_card_str" : member_card_str,
        "memb_is_staff" : member.is_tagged_with("Staff"),
        "evt_arrival"   : VisitEvent.EVT_ARRIVAL,
        "evt_departure" : VisitEvent.EVT_DEPARTURE,
    }
    return render(request, 'members/kiosk-main-menu.html', params)
开发者ID:adrianboyko,项目名称:xerocraft-django,代码行数:16,代码来源:views.py

示例6: member_calendar

# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import get_by_card_str [as 别名]
def member_calendar(request, token):

    # See if token corresponds to a Worker's calendar_token:
    try:
        worker = Worker.objects.get(calendar_token=token)
        member = worker.member
    except Worker.DoesNotExist:
        member = None

    # If token didn't correspond to nag, see if it's a member card string:
    if member is None:
        member = Member.get_by_card_str(token)

    if member is None:
        raise Http404("No such calendar")

    cal = _new_calendar("My Xerocraft Tasks")
    for task in _gen_tasks_for(member):
        _add_event(cal, task, request)
        #TODO: Add ALARM
    return _ical_response(cal)
开发者ID:SRCprogramming,项目名称:cirqueroots-django,代码行数:23,代码来源:views.py

示例7: _get_task_and_member

# 需要导入模块: from members.models import Member [as 别名]
# 或者: from members.models.Member import get_by_card_str [as 别名]
def _get_task_and_member(task_pk, member_card_str):

    try:
        task = Task.objects.get(pk=task_pk)
    except Task.DOES_NOT_EXIST:
        msg = "Info provided doesn't correspond to a task."
        _logger.error(msg)
        return None, None, JsonResponse({"error": msg})

    if task.work_start_time is None or task.work_duration is None:
        msg = "Expected a task with a specific time window."
        _logger.error(msg)
        return None, None, JsonResponse({"error": msg})

    member = Member.get_by_card_str(member_card_str)
    if member is None:
        # This might legitimately occur if an invalidated card is presented at the kiosk.
        msg = "Info provided doesn't correspond to a member."
        _logger.warning(msg)
        return None, None, JsonResponse({"error": msg})

    return task, member, None
开发者ID:SRCprogramming,项目名称:cirqueroots-django,代码行数:24,代码来源:views.py


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