user10309179
user10309179

Reputation:

Extend the Existing User Model with AbstractUser method error object 'User' has no attribute 'REQUIRED_FIELDS'

I'm trying to extend user but getting errors

settings.py

AUTH_USER_MODEL = 'bffcode.User'

models.py

from django.db import models
from django.contrib.auth.models import User
from django.contrib.auth.models import AbstractUser


class User(AbstractUser):
    fb_userid = models.CharField(max_length=256)
    objects =AbstractUser()

views.py

def fb_login(request):
     users = User.objects.filter(fb_userid=fb_user_id)

Error: enter image description here

Upvotes: 1

Views: 170

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599956

You've set the objects attribute of your User class to an instance of AbstractUser. It is supposed to be a Manager.

Unless you actually have a custom Manager subclass, it's best to leave this alone; you should delete that line.

Upvotes: 2

Related Questions