title: How to Integrate Django's auth models with custom REACT front-end sign up
body: <p>So, this question might be way too abstract but I feel the need to shoot the shot here. The Django I have been taught to use is quite out of convention where they do not use Django's default auth models/views. I will show you the example of my past SignUpView below:</p>
  <pre><code>from .models import Customer
  
  
  class SignUpView(View):
      def post(self, request):
          data = json.loads(request.body)
  
          try:
              validate_email(data['email'])
              if len(data['password']) &lt; 6:
                  return JsonResponse({'message': '6자리 이상 입력하세요'}, status=400)
              if not Customer.objects.filter(email = data['email']).exists():
                  hashed_password = bcrypt.hashpw(data['password'].encode('utf-8'), bcrypt.gensalt()).decode('utf-8')
                  Customer.objects.create(
                          email = data['email'],
                          password = hashed_password,
                          username = data['username'],
                          phone = data['phone']
                  )
                  return JsonResponse({'message':'SUCCESS'}, status=200)
              else:
                  return JsonResponse({'message':'ALREADY_EXIST'}, status=400)
          except KeyError:
              return JsonResponse({'message':'INVALID_KEYS'}, status=400)
          except ValidationError:
              return JsonResponse({'message':'INVALID_EMAIL'}, status=400)
  </code></pre>
  <p>However, here comes the day I get requested to create SuperUser functionality and custom permission functionality, thus forcing me to give up on the way I was taught to make signup view. Below is what I have created today, following along some blog post</p>
  <pre><code>from django.shortcuts               import render
  from django.contrib.auth.models     import User
  from django.contrib.auth.models     import Permission
  from django.contrib.auth.forms      import UserCreationForm
  from django.views                   import View
  from django.contrib.auth            import login
  from django.contrib.auth.decorators import login_required
  
  @login_required
  def index(request):
      return render(request,'accounts/index.html')
  
  class SignUpView(View)
      def post(request):
          context = {}
          form = UserCreationForm(request.POST or None)
          if request.method == &quot;POST&quot;:
              if form.is_valid():
                  user = form.save()
                  login(request,user)
                  return render(request,'accounts/index.html')
          context['form']=form
          return render(request,'registration/sign_up.html',context)
  </code></pre>
  <p>The code I just created won't work because I am not using the Django templates but rather my front-end teammates are creating forms, just like before. So, I will be receiving potential user's signup form using codes like so:</p>
  <pre><code>data = json.loads(request.body)
  email = data['email']
  password = bcrypt.hashpw(data['password'].encode('utf-8'), bcrypt.gensalt()).decode('utf-8')
  username = data['username']
  phone = data['phone']
  </code></pre>
  <p>Is there any way I can integrate Django's Auth functionality with custom sign up form like I just demonstrated? Thanks a lot in advance!</p>