Skip to content

Instantly share code, notes, and snippets.

@jrm2k6
Last active December 22, 2015 17:29
Show Gist options
  • Select an option

  • Save jrm2k6/6506297 to your computer and use it in GitHub Desktop.

Select an option

Save jrm2k6/6506297 to your computer and use it in GitHub Desktop.
Dehydrate error
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