Fixes typos in PERMISSION_CHOICES
Fixes spacing for PERMISSION_CHOICES
Fixes spacing for implications
Corrects use of /Classes/All deadlines
Adds PERMISSION_CHOICES_FLAT
Corrects logic around program=None permissions

Corrects and cleans up isAdministrator(), isOnsite(), and
user_has_perm().

In particular, fixes Github issue #1295 in isAdministrator(). We want
Administer on None to imply Administer on all programs, but we cannot
perform the check for all possible Permission objects with the query
program__in=[None, program]. Instead, we must write the query as
(Q(program=None) | Q(program=program)).
Adds PermissionTestCase

Adds testing code coverage for the Permission class. This class was
previously untested.

Adds some basic test coverage for user_has_perm(), including tests to
catch possible regressions of Github issue #1295 (which was fixed in the
previous commit 1b07c07a).
Adds separate teacherreg deadline for open classes

Adds a new teacherreg deadline to control open class (a.k.a. walk-in
activity) registration separately from normal class registration.

Sometimes directors want to leave open class registration open longer
than normal class registration. This was previously impossible, because
they used the same deadline.

This commit adds two new deadlines, Teacher/Classes/Create/Class and
Teacher/Classes/Create/OpenClass. The latter is for open classes only,
and the former is for normal classes (and associated functionalities,
such as class copying). The original deadline, Teacher/Classes/Create,
continues to exist, and implies both of the new deadlines. In this way,
the code is backwards-compatible with old settings, and no data
migration is necessary. And when directors want both types of
registration open at the same time, they can make use of this
implication so they only have to set one permission. The program
creation form should also continue to use this permission.

Resolves Github issue #1156.
Merge pull request #1310 from learning-unlimited/users-fixes

Users fixes