Exemple #1
0
def check_out_team(request, team_id):
    team = get_object_or_404(HospiTeam, pk=team_id)
    members = team.members.all()
    try:
        room = team.leader.room_occupant.all()[0]
        room.occupants.remove(team.leader)
        room.save()
        log_entry = HospiLog.objects.get(user=team.leader)
        log_entry.checked_out = True
        log_entry.checkout_time = datetime.datetime.now()
        log_entry.checked_out_by = request.user
        log_entry.save()
    except:
        return u.checkout_bill(request, team_id)
    for member in members:
        try:
            room = member.room_occupant.all()[0]
            room.occupants.remove(member)
            room.save()
            log_entry = HospiLog.objects.get(user=member)
            log_entry.checked_out = True
            print log_entry
            log_entry.checkout_time = datetime.datetime.now()
            log_entry.checked_out_by = request.user
            log_entry.save()
        except Exception, e:
            return u.checkout_bill(request, team_id)
Exemple #2
0
def print_bill(request, team_id):
    return u.checkout_bill(request, team_id)