How to register users in Django REST framework?

前端 未结 9 1473
说谎
说谎 2020-11-28 17:34

I\'m coding a REST API with Django REST framework. The API will be the backend of a social mobile app. After following the tutorial, I can serialise all my models and I am a

9条回答
  •  天命终不由人
    2020-11-28 18:22

    @cpury above suggested using write_only_fields option. This however did not work for me in DRF 3.3.3

    In DRF 3.0 the write_only_fields option on ModelSerializer has been moved to PendingDeprecation and in DRF 3.2 replaced with a more generic extra_kwargs:

    extra_kwargs = {'password': {'write_only': True}}

提交回复
热议问题