You can create your own view decorator that checks that a user is a member of a group
from django.contrib.auth.decorators import user_passes_test
def is_teacher(user):
return user.groups.filter(name='Teacher').exists()
@user_passes_test(is_teacher)
def my_view(request)
...
Docs for user_passes_test
Then all you have to do is create a Group with name "Teacher" and add teachers to that group