mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 09:02:11 +01:00 
			
		
		
		
	Update translations
This commit is contained in:
		
							
								
								
									
										0
									
								
								apps/member/management/commands/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								apps/member/management/commands/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										30
									
								
								apps/member/management/commands/create_su.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								apps/member/management/commands/create_su.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
import os
 | 
			
		||||
from datetime import date
 | 
			
		||||
from getpass import getpass
 | 
			
		||||
 | 
			
		||||
from django.core.management import BaseCommand
 | 
			
		||||
from member.models import TFJMUser
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Command(BaseCommand):
 | 
			
		||||
    def handle(self, *args, **options):
 | 
			
		||||
        email = input("Email: ")
 | 
			
		||||
        password = "1"
 | 
			
		||||
        confirm_password = "2"
 | 
			
		||||
        while password != confirm_password:
 | 
			
		||||
            password = getpass("Password: ")
 | 
			
		||||
            confirm_password = getpass("Confirm password: ")
 | 
			
		||||
            if password != confirm_password:
 | 
			
		||||
                self.stderr.write(self.style.ERROR("Passwords don't match."))
 | 
			
		||||
 | 
			
		||||
        user = TFJMUser.objects.create(
 | 
			
		||||
            email=email,
 | 
			
		||||
            password="",
 | 
			
		||||
            role="admin",
 | 
			
		||||
            year=os.getenv("TFJM_YEAR", date.today().year),
 | 
			
		||||
            is_active=True,
 | 
			
		||||
            is_staff=True,
 | 
			
		||||
            is_superuser=True,
 | 
			
		||||
        )
 | 
			
		||||
        user.set_password(password)
 | 
			
		||||
        user.save()
 | 
			
		||||
		Reference in New Issue
	
	Block a user