Django 'User' Object Has No Attribute 'user'
In my model I have a class class User(AbstractDateTime, AbstractBaseUser, PermissionsMixin, models.Model): email = models.EmailField(max_length=255, unique=True,blank=False,de
Solution 1:
Your function last_seen
has a bug. You were doing self.user.email
which is incorrect, it should be self.email
.
Also, it's not good practice to do User.objects.filter()
, because filter
is used for doing lookup with conditions like sql WHERE
. If you want all results, do User.objects.all()
.
Post a Comment for "Django 'User' Object Has No Attribute 'user'"