0

This is the Custom user model

I also declared in settings

AUTH_USER_MODEL="recipes.CustomUser"

still I face this error ValueError:The field admin.LogEntry.user was declared with a lazy reference to 'recipes.customuser',but app'recipes'doesn't provide model 'customuser'`

from django.db import models
from django.http import HttpResponse
from django.contrib.auth.models import AbstractUser, Permission
from django.conf import settings
from django.contrib.auth import get_user_model
import secrets

class CustomUser(AbstractUser):
    email=models.EmailField(unique=True)
    
    USERNAME_FIELD="email"
    REQUIRED_FIELDS=["username"]
    
    def __str__(self) -> str:
        return self.email

3
  • Hi, welcome to SO. Your question seems unclear what you want to achieve, please add more details to the question. Share your setting file and other relevant info. Commented Jul 19, 2024 at 13:18
  • AUTH_USER_MODEL="recipes.CustomUser do you have your CustomUser set up in recipes app? Commented Jul 19, 2024 at 13:57
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Jul 20, 2024 at 9:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.