"Magic Link" Management Command
Django Management Command to print a "Magic Link" for one-click log-in. This is nice for people who project switch or don't want to remember passwords.
- authentication
- magic
- management
- command
Django Management Command to print a "Magic Link" for one-click log-in. This is nice for people who project switch or don't want to remember passwords.
This validator works well with FileField form fields and can validate that an uploaded file has an acceptable mimetype. Place this snippet in your app's `validators.py`. Requirements: This snippet uses [python-magic](https://github.com/ahupp/python-magic). To install: pip install python-magic Usage (in forms.py): from validators import MimetypeValidator class MyForm(forms.Form): file = forms.FileField( allow_empty_file=False, validators=[MimetypeValidator('application/pdf')], help_text="Upload a PDF file" )
I tend to have all my python code together in a 'python' directory. e.g. a typical project layout of mine looks like: /python /python/myproject - project python code /python/django - local copy of django /python/foolib - some third party library /media /templates ... Since I don't want to set the python path explicitly I just assume the 'manage.py' is in the right place and use its __file__ variable to set up the python path correctly. I use the same trick for my settings.py for setting MEDIA_ROOT and TEMPLATE_DIRS.
3 snippets posted so far.