mirror of
				https://gitlab.crans.org/bde/nk20-scripts
				synced 2025-10-30 22:59:52 +01:00 
			
		
		
		
	Update README, fixed make_su script
This commit is contained in:
		| @@ -5,7 +5,6 @@ from datetime import date | ||||
|  | ||||
| from django.core.management import BaseCommand | ||||
| from django.db.models import Q | ||||
|  | ||||
| from member.models import Membership, Club | ||||
| from wei.models import WEIClub | ||||
|  | ||||
|   | ||||
| @@ -1,23 +1,22 @@ | ||||
| #!/usr/bin/env python3 | ||||
|  | ||||
| # Copyright (C) 2018-2020 by BDE ENS Paris-Saclay | ||||
| # SPDX-License-Identifier: GPL-3.0-or-later | ||||
|  | ||||
| from django.core.management.base import BaseCommand | ||||
|  | ||||
| from django.contrib.auth.models import User | ||||
|  | ||||
|  | ||||
|  | ||||
| class Command(BaseCommand): | ||||
|     def add_arguments(self,parser): | ||||
|         parser.add_argument('username',nargs='+',type=str) | ||||
|         parser.add_argument('-S',"--SUPER",action='store_true',help='make superuser') | ||||
|          | ||||
|     def add_arguments(self, parser): | ||||
|         parser.add_argument('username', nargs='+', type=str) | ||||
|         parser.add_argument('-S', "--SUPER", action='store_true', help='make superuser') | ||||
|         parser.add_argument('-s', "--STAFF", action='store_true', help='make staff') | ||||
|  | ||||
|     def handle(self,*args,**kwargs): | ||||
|     def handle(self, *args, **kwargs): | ||||
|         for uname in kwargs["username"]: | ||||
|             user = User.objects.get(username=uname) | ||||
|             user.is_active = True | ||||
|             if kwargs['SUPER']: | ||||
|             if kwargs['STAFF']: | ||||
|                 user.is_staff = True | ||||
|             if kwargs['SUPER']: | ||||
|                 user.is_superuser = True | ||||
|             user.save() | ||||
|                  | ||||
|   | ||||
| @@ -2,7 +2,6 @@ | ||||
| # SPDX-License-Identifier: GPL-3.0-or-later | ||||
|  | ||||
| from django.core.management import BaseCommand | ||||
|  | ||||
| from wei.forms import CurrentSurvey | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user