Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit48fe0f9

Browse files
Add a command to unrestrict a given user
1 parent449ba9c commit48fe0f9

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
fromdjango.core.managementimportBaseCommand
2+
3+
fromcrashmanager.modelsimportUser
4+
5+
6+
classCommand(BaseCommand):
7+
help="Remove the restricted flag from the specified user."
8+
9+
defhandle(self,*args,**options):
10+
user=User.objects.get(user__username=options["user"])
11+
ifuser.restricted:
12+
user.restricted=False
13+
user.save()
14+
print(f"{options['user']} is now unrestricted")
15+
else:
16+
print(f"{options['user']} was already unrestricted")
17+
18+
defadd_arguments(self,parser):
19+
parser.add_argument("user")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp