AttributeError: 'SelectQuery' object has no attribute 'is_active'
As the error suggests, user = User.select().where(User.email == resp.email)
gives you back a SelectQuery
, not an instance of User
. You'll want to include an additional method call to actually fetch the record, something like .first()
. first
will return either an instance of User
or None
.
This would allow you to slightly adjust your code:
user = User.select().where(User.email == resp.email).first()if not user: # or if user is None: nickname = resp.nickname ...