Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar view improvements #257

Merged
merged 2 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/api/management/commands/makeAdmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class Command(BaseCommand):

help = 'seed the db with data'
help = 'make yourself admin'

def add_arguments(self, parser):
parser.add_argument('username', type=str, help='The username of the student user to make admin')
Expand All @@ -18,4 +18,4 @@ def handle(self, *args, **options):
student = student.get()
student.is_staff = True
student.save()
self.stdout.write(self.style.SUCCESS('Successfully made yourself admin!'))
self.stdout.write(self.style.SUCCESS('Successfully made the user admin!'))
21 changes: 21 additions & 0 deletions backend/api/management/commands/makeTeacher.py
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
from api.models.teacher import Teacher


class Command(BaseCommand):

help = 'make yourself teacher'

def add_arguments(self, parser):
parser.add_argument('username', type=str, help='The username of the student user to make teacher')

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()
Teacher.objects.create(id=student.id, create_time=student.create_time)
self.stdout.write(self.style.SUCCESS('Successfully made the user teacher!'))
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading