
    Ƿi"                     j    d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	 ddl
mZ dZ G d d	e          Zd
S )z
set_fake_emails.py

    Give all users a new email account. Useful for testing in a
    development environment. As such, this command is only available when
    setting.DEBUG is True.

    )List)settings)get_user_model)BaseCommandCommandError)signalcommandz%(username)s@example.comc                   \     e Zd ZU dedZg Zee         ed<    fdZ	e
d             Z xZS )CommandzEDEBUG only: give all users a new email based on their account data ("zG" by default). Possible parameters are: username, first_name, last_namerequires_system_checksc                    t                                          |           |                    ddt          d           |                    ddddd	d
           |                    ddddd	d           |                    ddd d           |                    ddd d           |                    ddd d           |                    ddd d           d S )Nz--emaildefault_emailz!Use this as the new email format.)destdefaulthelpz-az
--no-admin
store_trueno_adminFz$Do not change administrator accounts)actionr   r   r   z-sz
--no-staffno_staffzDo not change staff accountsz	--includeinclude_regexpz'Include usernames matching this regexp.z	--excludeexclude_regexpz'Exclude usernames matching this regexp.z--include-groupsinclude_groupszMInclude users matching this group. (use comma seperation for multiple groups)z--exclude-groupsexclude_groupszMExclude users matching this group. (use comma seperation for multiple groups))superadd_argumentsadd_argumentDEFAULT_FAKE_EMAIL)selfparser	__class__s     m/srv/django_bis/venv311/lib/python3.11/site-packages/django_extensions/management/commands/set_fake_emails.pyr   zCommand.add_arguments   sQ   f%%%O5G4 	 	
 	
 	
 	,|* F 	 	
 	
 	
 	,|* > 	 	
 	
 	
 	.: 	 	
 	
 	
 	.: 	 	
 	
 	
 	%5t` 	 	
 	
 	
 	%5t` 	 	
 	
 	
 	
 	
    c                    t           j        st          d          ddlm} |d         }|d         }|d         }|d         }|d         }|d	         }	|d
         }
t                      }|j                                        }|	r|                    d          }|
r|                    d          }|rY|j        	                    |
                    d                    }|r|                    |          }nt          d|z            |rY|j        	                    |
                    d                    }|r|	                    |          }nt          d|z            |r|                    |          }|r|	                    |          }|D ]3}||j        |j        |j        dz  |_        |                                 4t!          d|                                z             d S )NzOnly available in debug moder   )Groupr   r   r   r   r   r   r   T)is_superuser)is_staff,)name__in)
groups__inzNo groups matches filter: %s)username__regex)username
first_name	last_namezChanged %d emails)r   DEBUGr   django.contrib.auth.modelsr#   r   objectsallexcludefiltersplitr*   r+   r,   emailsaveprintcount)r   argsoptionsr#   r4   r   r   r   r   r   r   Userusersgroupsusers                  r    handlezCommand.handle9   s+   ~ 	?=>>>444444( !12 !12 !12 !12:&:&  "" 	5MMtM44E 	1MM4M00E 	T]))>3G3G3L3L)MMF T88"#AN#RSSS 	T]))>3G3G3L3L)MMF T77"#AN#RSSS 	BMM.MAAE 	ALLL@@E 	 	Ddm04/3~"? "? ?DJ IIKKKK!EKKMM122222r!   )__name__
__module____qualname__r   r   r   r   str__annotations__r   r   r>   __classcell__)r   s   @r    r
   r
      s           dv  dv  dv  yD(*DI***
 
 
 
 
> (3 (3 ](3 (3 (3 (3 (3r!   r
   N)__doc__typingr   django.confr   django.contrib.authr   django.core.management.baser   r   "django_extensions.management.utilsr   r   r
    r!   r    <module>rL      s                       . . . . . . A A A A A A A A < < < < < </ L3 L3 L3 L3 L3k L3 L3 L3 L3 L3r!   