From c7e24529dcb54a39e4878e5eb3ee405169437228 Mon Sep 17 00:00:00 2001 From: Bram Meir Date: Mon, 8 Apr 2024 23:05:37 +0200 Subject: [PATCH] fix: makeTeacher command --- backend/api/management/commands/makeTeacher.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/api/management/commands/makeTeacher.py b/backend/api/management/commands/makeTeacher.py index 31417606..378675bc 100644 --- a/backend/api/management/commands/makeTeacher.py +++ b/backend/api/management/commands/makeTeacher.py @@ -1,5 +1,5 @@ from django.core.management.base import BaseCommand -from api.models.student import Student +from authentication.models import User from api.models.teacher import Teacher @@ -12,10 +12,10 @@ def add_arguments(self, parser): def handle(self, *args, **options): username = options['username'] - student = Student.objects.filter(username=username) - if student.count() == 0: + user = User.objects.filter(username=username) + if user.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) + user = user.get() + Teacher(user_ptr=user).save_base(raw=True) self.stdout.write(self.style.SUCCESS('Successfully made the user teacher!'))