How to Hash Django user password in Django Rest Framework?
<p>I'm trying to create an API for my user registration using Django Rest Framework. I created a serializer by following the step from the <a href="http://www.django-rest-framework.org/api-guide/serializers/" rel="noreferrer">api-guide</a></p>

<pre><code>class CreateUserSerializer(serializers.ModelSerializer):
  class Meta:
    model = User
    fields = ('email', 'username', 'password')
    extra_kwargs = {'password': {'write_only': True}}

  def create(self, validated_data):
    user = User(
        email=validated_data['email'],
        username=validated_data['username']
    )
    user.set_password(validated_data['password'])
    user.save()
    return user
</code></pre>

<p>However, I keep getting the <code>Invalid password format or unknown hashing algorithm.</code> for my newly created user. I've tried to use <code>make_password</code> from <code>django.contrib.auth.hashers</code>, but I still can't resolve this issue. </p>

<p>Thanks</p>