1👍
Seems it something wrong in your architecture. You shouldn’t access request in models layer. All work with request must be done in view. You can do it like this:
user, created = AbstractUser.objects.get_or_create(name=name)
if created:
look_for_invite_in_session_and_register_if_found(user, request.session)
Source:stackexchange.com