Exemple #1
0
def testing(req):
    checkadmin(req)
    now = datetime.datetime.now()
    current_slot_id = Slot.objects.filter(start_hour=now.hour,
                                          start_minute__lt=now.minute,
                                          end_minute__gt=now.minute)

    current_slot_id = -1 if not current_slot_id else current_slot_id[0].id

    current_bookings = Booking.objects.filter(
        slot_id=current_slot_id,
        booking_date=datetime.date.today()).select_related()
    current_mids = list([-1]) if not current_bookings else [
        current_booking.account.board.mid
        for current_booking in current_bookings
    ]

    boards = Board.objects.filter(online=1)
    allotment_mode = "Random" if Board.can_do_random_allotment(
    ) else "Workshop"
    return render(req, 'admin/testexp.html', {
        "boards": boards,
        "allotment_mode": allotment_mode,
        "mids": current_mids
    })
Exemple #2
0
def index(req):
    checkadmin(req)
    boards = Board.objects.order_by('online').all()
    allotment_mode = "Random" if Board.can_do_random_allotment(
    ) else "Workshop"
    return render(req, 'admin/index.html', {
        "boards": boards,
        "allotment_mode": allotment_mode
    })