-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into extra_checks
# Conflicts: # backend/authentication/fixtures/users.yaml # backend/poetry.lock # backend/pyproject.toml
- Loading branch information
Showing
36 changed files
with
1,301 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from django.core.management.base import BaseCommand | ||
from api.models.student import Student | ||
|
||
|
||
class Command(BaseCommand): | ||
|
||
help = 'seed the db with data' | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument('username', type=str, help='The username of the student user to make admin') | ||
|
||
def handle(self, *args, **options): | ||
username = options['username'] | ||
student = Student.objects.filter(username=username) | ||
if student.count() == 0: | ||
self.stdout.write(self.style.ERROR('User not found, first log in !')) | ||
return | ||
student = student.get() | ||
student.is_staff = True | ||
student.save() | ||
self.stdout.write(self.style.SUCCESS('Successfully made yourself admin!')) |
Oops, something went wrong.