You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

21 lines
592 B

from courses.models import Course
class InApiTeacher:
@staticmethod
def add_teacher(slug: str, token: str) -> Course:
course = Course.objects.get(slug=slug)
course.teacher_tokens.append(token)
course.save()
return course
@staticmethod
def delete_teacher(slug: str, token: str) -> None:
course = Course.objects.get(slug=slug)
course.teacher_tokens.remove(token)
course.save()
return None
@staticmethod
def get_token_list(slug: str) -> list:
return Course.objects.get(slug=slug).teacher_tokens