--
You received this message because you are subscribed to the Google Groups "django-rest-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
On Wed, Mar 27, 2013 at 6:59 PM, <mars...@poundpay.com> wrote:
I did some googling but didn't find any results.Is it possible to have write only fields? E.g. I want the serializer to validate some data in the payload but I don't want to echo that back.E.g. a password field shouldn't be echoed back:class UserLoginsSerializer(serializers.Serializer):email_address = serializers.EmailField(required=True)password = serializers.CharField(required=True, write_only=True)
--
You received this message because you are subscribed to the Google Groups "django-rest-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+unsub...@googlegroups.com.
class UserSerializer(serializers.HyperlinkedModelSerializer):created_at = serializers.Field(source='date_joined')class Meta:model = Userfields = ['id', 'url', 'username', 'password', 'first_name', 'last_name', 'email', 'created_at', ]def restore_object(self, attrs, instance=None):user = super(UserSerializer, self).restore_object(attrs, instance)user.set_password(attrs['password'])return userdef to_native(self, obj):ret = super(UserSerializer, self).to_native(obj)del ret['password']return ret