1
I believe the line
School.objects.create(name='DPS', address='Some Address')
is an independent expression. As long as it passed the teacher filter, it will execute in the code because it has no idea about the context or the permission. You can simply use conditionals to achieve what you want.
Source:stackexchange.com