This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
import os | |
import mimetypes | |
from django.core.files.uploadedfile import SimpleUploadedFile | |
from tastypie import fields | |
class Base64FileField(fields.FileField): | |
""" | |
A django-tastypie field for handling file-uploads through raw post data. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# template tag: {% url django.contrib.auth.views.password_reset_confirm uidb36=uidb36 token=token %} | |
from django.utils.http import int_to_base36 | |
from django.contrib.auth.tokens import default_token_generator | |
from django.contrib.auth.models import User | |
user = User.objects.get(pk=1) | |
context = { | |
'uidb36': int_to_base36(user.pk), | |
'token' = default_token_generator.make_token(user), |