![]() ![]() In the get_serializer_class function I defined which serializer to use on each endpoint. I use the mixins CreateModelMixin, ListModelMixin and RetrieveModelMixin of Django REST framework to already have respectively the endpoints of creation, listing, and getting a user detail. This is the ViewSet defined as the view of the user's app. ![]() Of each led user I only want the id and username. When getting a user detail, I want the id, username, first and last names, leader id and the led users. In the listing endpoint, I want to show only the id and username of each user. The endpoint receives this data and returns id, first and last names, and username. I want to ask for a unique username, mandatory first name and last name, and password and password confirmation. After the installation and setup, I only need to code the features, and the documentation will be created for me. Let’s see the views, functions and serializers of this project, to understand all the work that the library does for us generating the documentation. The important mentioned fields are inherited from the User class. Let’s see the definition of the model in the users app: The important fields in this reality are:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |