def kiosk(request, location=None): if location and Tool.objects.filter(_location=location, visible=True).exists(): reader_id = request.GET.get("reader_id") dictionary = { "location": location, "badge_reader": BadgeReader.objects.get( id=reader_id) if reader_id else BadgeReader.default(), } return render(request, "kiosk/kiosk.html", dictionary) else: locations = sorted( list( set([ tool.location for tool in Tool.objects.filter(visible=True) ]))) dictionary = { "locations": [{ "url": reverse("kiosk", kwargs={"location": location}), "name": location } for location in locations] } return render(request, "kiosk/location_directory.html", dictionary)
def kiosk(request, location=None): if location and Tool.objects.filter(_location=location, visible=True).exists(): reader_id = request.GET.get("reader_id") dictionary = { 'location': location, 'badge_reader': BadgeReader.objects.get( id=reader_id) if reader_id else BadgeReader.default(), } return render(request, 'kiosk/kiosk.html', dictionary) else: locations = sorted( list( set([ tool.location for tool in Tool.objects.filter(visible=True) ]))) dictionary = { 'locations': [{ 'url': reverse('kiosk', kwargs={'location': location}), 'name': location } for location in locations] } return render(request, 'kiosk/location_directory.html', dictionary)
def farewell_screen(request, door_id): door = get_object_or_404(Door, id=door_id) reader_id = request.GET.get("reader_id") badge_reader = BadgeReader.objects.get( id=reader_id) if reader_id else BadgeReader.default() return render(request, "area_access/farewell_screen.html", { "area": door.area, "door": door, "badge_reader": badge_reader })
def farewell_screen(request, door_id): door = get_object_or_404(Door, id=door_id) reader_id = request.GET.get("reader_id") badge_reader = BadgeReader.objects.get(id=reader_id) if reader_id else BadgeReader.default() return render(request, 'area_access/farewell_screen.html', {'area': door.area, 'door': door, 'badge_reader': badge_reader})