title: django signals. how to create a unique dispatch id?
body: <p>sometimes signals in django are triggered twice. In the docs it says that a good way to create a (unique) <code>dispatch_uid</code> is either the path or name of the module[1] or the id of any hashable object[2].</p>
  
  <p>Today I tried this:</p>
  
  <pre><code>import time
  my_signal.connect(my_function, dispatch_uid=str(time.time()))
  </code></pre>
  
  <p>However I am afraid that in a multiuser environment (like in the case of a web site). This might be broken. What is a good and safe way to create such an id in a multiuser environment?</p>
  
  <p>[1] <a href="https://code.djangoproject.com/wiki/Signals" rel="nofollow">https://code.djangoproject.com/wiki/Signals</a></p>
  
  <p>[2] <a href="https://docs.djangoproject.com/en/dev/topics/signals/#preventing-duplicate-signals" rel="nofollow">https://docs.djangoproject.com/en/dev/topics/signals/#preventing-duplicate-signals</a></p>