I want to create django users from django application, and then confirming user creation by sending them e-mail with validation link.
How can I safely generate this link from user details (I don’t want to generate random value and store it in DB, and I don’t want to use any external modules like Pinax for this)
You’ll want to go grab django-registration and call it a done: http://bitbucket.org/ubernostrum/django-registration/wiki/Home
Docs on how to integrate and use it: http://bitbucket.org/ubernostrum/django-registration/src/tip/docs/overview.txt
It manages the reg key, timeout period and all processing for activating an account.
I have used this a few times with slight mods and it is very easy to get going testing using even a gmail account for sending to test.
Add this to your settings.py in the app to test with a gmail account:
Also, django-profiles is a great addition to this django-registration kit: http://bitbucket.org/ubernostrum/django-profiles/wiki/Home