Last active
December 22, 2015 17:29
-
-
Save jrm2k6/6506297 to your computer and use it in GitHub Desktop.
Dehydrate error
This file contains hidden or 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
| from tastypie.resources import ModelResource | |
| from simplereader_client.models import ReaderUser, Feed | |
| from django.contrib.auth.models import User | |
| from tastypie.authentication import ( | |
| Authentication, ApiKeyAuthentication, BasicAuthentication, | |
| MultiAuthentication) | |
| from tastypie.authorization import Authorization | |
| from tastypie import fields | |
| from tastypie.constants import ALL | |
| import hashlib | |
| class CreateReaderUserResource(ModelResource): | |
| class Meta: | |
| allowed_methods = ['post'] | |
| always_return_data = True | |
| authentication = Authentication() | |
| authorization = Authorization() | |
| queryset = ReaderUser.objects.all() | |
| resource_name = 'newuser' | |
| class ReaderUserResource(ModelResource): | |
| class Meta: | |
| queryset = ReaderUser.objects.all() | |
| resource_name = 'user' | |
| filtering = { | |
| 'email': ['exact'], | |
| 'pw': ['exact'], | |
| 'first_name': ['exact'] | |
| } | |
| def dehydrate_pw(self, bundle): | |
| #bundle.data['pw'] = hashlib.sha1(bundle.data['pw']).hexdigest() | |
| bundle.data['pw'] = bundle.data['pw'].lower() | |
| return bundle.data['pw'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment