'I have a error called "name 'CustomUser' is not defined"

#This is my models from django.contrib.auth.models import AbstractUser

Create your models here.

class CustomUser(AbstractUser): USER = ( (1,'HOD'), (2, 'STAFF'), (3, 'STUDENT'), ) user_type = models.CharField(choices=USER,max_length=50,default=1) profile_pic = models.ImageField(upload_to='media/profile_pic')

this is my views

@login_required(login_url='/') def Profile(request): user = CustomUser.objects.get(id = request.user.id)

context = {
    "user":user,
}
return render(request,'Profile.html' ,context)

my settings.py

AUTH_USER_MODEL = 'apps.CustomUser'



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source