Well, I gave up.  I had hoped it would be a little cleaner but this
works:

def _getTeachers():
   u = users.get_list(
         tables=['auth_users_groups','auth_groups'],
         where=["auth_groups.name = 'teacher'",
            "auth_users_groups.group_id = auth_groups.id",
            "auth_users_groups.user_id = auth_users.id"])
   return tuple([(y[0:2],y) for y in [str(x) for x in u]])

def _getStudents():
   s =  users.get_list(
         tables=['auth_users_groups','auth_groups'],
         where=["auth_groups.name = 'student'",
            "auth_users_groups.group_id = auth_groups.id",
            "auth_users_groups.user_id = auth_users.id"])
   return tuple([(y[0:2],y) for y in [str(x) for x in s]])

# Create your models here.
class Assignment(meta.Model):
   id = meta.AutoField('ID', primary_key=True)
   assigner = meta.ForeignKey(User, choices=_getTeachers(),
verbose_name="user making assignment")
   assignee = meta.ForeignKey(User, choices=_getStudents(),
verbose_name="user receiving assignment")

Reply via email to