views:

43

answers:

0

Hello everyone. I have this code that works. My class is a db.Model one2many with a teacher, experience, and so on...

What I want is to call the class teacher with forms, but also intend to include other classes, like a form from experience class and a form from category. These classes are as foreign Key teacher.

I wonder how to derive classes for teachers

This is my main:

class CreateCvHandler(webapp.RequestHandler):
    def post(self):
        if self.request.get('EscTeacher'):
            id = int(self.request.get('EscTeacher'))
            teacher=models.teacher.get(db.Key.from_path('Teacher', id))
        else:
            teacher= models.teacher()
        data = forms.TeacherForm(data = self.request.POST)
        if data.is_valid():
            userList= models.Account.all()
            userList.filter('user =', users.get_current_user())
            for user in userList:
                teacher.user=user.key()
            teacher.unity=self.request.get('unity')
            teacher.category=self.request.get('category')
            teacher.regime=self.request.get('regime')
            teacher.put()
            self.redirect('/academy')
        else:
            self.redirect('/createCv'

Can anyone send me a snippet

Thanks