Skip to content

Instantly share code, notes, and snippets.

@akshar-raaj
Created July 22, 2019 19:16
Show Gist options
  • Select an option

  • Save akshar-raaj/1c0f3bcb8a2b78f3a17bdad1179bce2d to your computer and use it in GitHub Desktop.

Select an option

Save akshar-raaj/1c0f3bcb8a2b78f3a17bdad1179bce2d to your computer and use it in GitHub Desktop.
Effective serializer for read
from rest_framework import serializers
from django.contrib.auth.models import User
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('username', 'email', 'first_name', 'last_name')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment