0

Usually when we create the the User model by inheriting AbstractUser which is eventually inherited from django.db.models.Model. e.g.

from django.contrib.auth.models import AbstractUser

class User(AbstractUser):

  id = models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True)
  username = models.CharField(max_length=150, unique=True)
  email = models.EmailField(unique=True)

But is it possible that instead of this, we create the user model using this code?

from google.cloud import ndb

class CustomUser(ndb.Model):

    username = ndb.StringProperty(required=True)
    email = ndb.StringProperty(required=True)

Will this have any ripple effects? e.g. third-party apps that rely on the default user model(maybe DRF).

I haven't tried it yet. I just wanna make sure if it's possible before I end up writing a lot of code.

hassansuhaib
  • 267
  • 3
  • 14

0 Answers0