2π
I am assuming your main idea is to use a unique string as an identifier and you are trying to use hashes as the unique strings.
If so, I would suggest using the uuid module.
Do something like
import uuid
unique_key = str(uuid.uuid4()).replace('-')
url = 'http://127.0.0.1:8080/hiring/application_form/{0}/'.format(unique_key)
# Store the unique_key in the DB with the user object,
# and use it in the email..etc.,
In the URL get map capture the UUID
url(r'^hiring/application_form/(?P<uuid>[a-f0-9]+)/$', applicant_form_view, name='application_form_view')
Then use it in the view and process as you wish.
1π
If I was in your shoes (depends on what you wrote here), Iβd think about some different strategy.
Instead of just hashing the URL, Iβd implement some kind of Map (on the server side) which will store entries of accountId/guestId/hashed URL (or any other unique identifier) to the time when the matching URL has created β then Iβd configure a basic throughput which will define for how long each entry is available (you can extend this mechanism as much as you want, itβs very straightforward).
** For the hashed URL you can use some implementation of SHA256 or any other and then encode it using base62 (base64 contains β/β and β?β if Iβm not wrong).
Let me know what do you think π
- [Django]-Django ImageField not uploading the image
- [Django]-Django: Python global variables overlap, even for separate runs