from .base_service import BaseService
from app.models import Student, Section


class StudentService(BaseService):

    def __init__(self):
        super(StudentService, self).__init__(Student)

    def all(self):
        return self.dbsession.query(Student).optoins(joinload(Student.section)
            ).filter(Section.school_id == self.request.school_id).all()

    def create(self, student):
        section = self.dbsession.query(Section).filter(Section.id ==
            student.section_id)
        if section is None:
            raise NoResourceFound('No Section found with given id.')
        self.has_access_to_school(section.school_id)
        super().create(student)

cfb7dae6ebdcfe028740f4d103164850fa8f5595
<mask token>


class StudentService(BaseService):
    <mask token>
    <mask token>

    def create(self, student):
        section = self.dbsession.query(Section).filter(Section.id ==
            student.section_id)
        if section is None:
            raise NoResourceFound('No Section found with given id.')
        self.has_access_to_school(section.school_id)
        super().create(student)

<mask token>


class StudentService(BaseService):

    def __init__(self):
        super(StudentService, self).__init__(Student)
    <mask token>

    def create(self, student):
        section = self.dbsession.query(Section).filter(Section.id ==
            student.section_id)
        if section is None:
            raise NoResourceFound('No Section found with given id.')
        self.has_access_to_school(section.school_id)
        super().create(student)

<mask token>


class StudentService(BaseService):

    def __init__(self):
        super(StudentService, self).__init__(Student)

    def all(self):
        return self.dbsession.query(Student).optoins(joinload(Student.section)
            ).filter(Section.school_id == self.request.school_id).all()

    def create(self, student):
        section = self.dbsession.query(Section).filter(Section.id ==
            student.section_id)
        if section is None:
            raise NoResourceFound('No Section found with given id.')
        self.has_access_to_school(section.school_id)
        super().create(student)

from .base_service import BaseService
from app.models import Student, Section


class StudentService(BaseService):

    def __init__(self):
        super(StudentService, self).__init__(Student)

    def all(self):
        return self.dbsession.query(Student).optoins(joinload(Student.section)
            ).filter(Section.school_id == self.request.school_id).all()

    def create(self, student):
        section = self.dbsession.query(Section).filter(Section.id ==
            student.section_id)
        if section is None:
            raise NoResourceFound('No Section found with given id.')
        self.has_access_to_school(section.school_id)
        super().create(student)
