
    xh                         S SK r S SKJr  S SKJrJr  S SKJr  S SKJ	r	  S SK
Jr  \ R                  " \5      r\	" \5      S 5       rg)    N)user_logged_in)SocialAccount	SocialApp)Prefetch)receiver)OrganizationUserc           	      R   [         R                  R                  [        R                  R                  US9R	                  SSS9S9R                  SS9R                  S5      R                  [        S	[        R                  R                  US9S
S95      R                  5       nU H~  nUR                  R                  R                  (       a  M*  UR                  R                  R                  U5        [        R!                  SUR                  R                   SU 35        M     g)z<
Add user to organization if organization-social app exists
)userproviderT)flat)provider__inN)organizationsocialapp#organizationsocialapp__organization7organizationsocialapp__organization__organization_usersmatched_user)querysetto_attrzAdded z to )r   objectsfilterr   values_listexcludeselect_relatedprefetch_relatedr   r   allr   organizationr   add_userloggerinfo)requestr
   kwargssocial_apps
social_apps        /code/apps/users/signals.py"add_user_to_socialapp_organizationr$      s    	  &..5545@LL M  	! 	

 
t	,	=	>		I)1188d8C&

 
 " "
//<<III,,99BB4HKK99FFGtD6R "    )loggingallauth.account.signalsr   allauth.socialaccount.modelsr   r   django.db.modelsr   django.dispatchr   apps.organizations_ext.modelsr   	getLogger__name__r   r$    r%   r#   <module>r/      sD     2 A % $ 
		8	$ 
. r%   