title: Django Creating a Custom User with the Django Rest Framework
body: <p>I'm trying to create a custom user using the Django Rest Framework. I got it to the point to where I can create a regular user, but I'm unsure on how to extend it to the custom user model.</p>
  
  <p>models.py:</p>
  
  <pre><code>from django.db import models
  from django.contrib.postgres.fields import ArrayField
  from django.contrib.auth.models import User
  
  
  class UserProfile(models.Model):
      user = models.OneToOneField(User, on_delete=models.CASCADE)
      languages = ArrayField(models.CharField(max_length=30, blank=True))
  </code></pre>
  
  <p>serializers.py:</p>
  
  <pre><code>from rest_framework import serializers
  from django.contrib.auth.models import User
  
  
  class UserSerializer(serializers.ModelSerializer):
      password = serializers.CharField(write_only=True)
  
      class Meta:
          model = User
          fields = ('first_name', 'last_name', 'email', 'username', 'password')
  
      def create(self, validated_data, instance=None):
          user = super(UserSerializer, self).create(validated_data)
          user.set_password(validated_data['password'])
          user.save()
          return user
  </code></pre>
  
  <p>views.py:</p>
  
  <pre><code>@api_view(['POST'])
  @permission_classes((AllowAny,))
  def create_user(request):
      serialized = UserSerializer(data=request.data)
      if serialized.is_valid():
          serialized.save()
          return Response(serialized.data, status=status.HTTP_201_CREATED)
      else:
          return Response(serialized._errors, status=status.HTTP_400_BAD_REQUEST)
  </code></pre>
  
  <p>How do I extend the <code>languages</code> field to the <code>UserSerializer</code> to where it can process it? Would it be better to create a <code>signal</code> for every time a <code>user</code> is created it then creates a <code>userprofile</code> automatically?</p>