title: How to queue requests in Django?
body: <p>I manage a physical locker with Django (DRF). Users fill out a form, authenticate via link sent to their e-mail, authorize via a pin displayed on the locker.</p>
  <p>My view should handle three cases:</p>
  <ul>
  <li><p>If user authenticates and authorizes successfully, pin displayed on
  the locker is replaced with a generic message and the locker opens.
  (Already implemented)</p>
  </li>
  <li><p>If the user fails to authorize within 3 minutes, locker pin is replaced with a generic message.</p>
  </li>
  <li><p>If a new authorization request is made by user Foo, while authorization for user Bar is still incomplete, stack the request in
  a queue and wait for case 1. or case 2. to complete.</p>
  </li>
  </ul>
  <p><strong>How can I:</strong></p>
  <ul>
  <li>Implement a request queue, such that the pin displayed on the locker does not get overridden/replaced when a new request comes in?</li>
  <li>How can I wait 3 minutes for authorization to be completed before processing the next request?</li>
  </ul>
  <p>View as is, in case it is useful:</p>
  <pre><code>   if request.method == 'POST':
          form = ConfirmationForm(request.POST)
          if form.is_valid():
              if pin == form.cleaned_data['pin']:
                  open_bay(jwt_token=jwt[1], pin=pin)
                  display_generic_message(jwt_token=jwt[1])
                  lock_bay(jwt_token=jwt[1], pin=pin)
                  return render(request, 'static/pages/request-success.html')
              else:
                  pass
      else:
          form = ConfirmationForm()
      return render(request, 'static/pages/confirmation.html', {'form': form})
  </code></pre>