def get(self): # get from ?link_id= in url, or hidden form field link_id = int(self.request.get('link_id')) link = StudentClass.get_by_id(link_id) link_form = StudentClassForm(instance=link) class_ = link.class_ doRender(self,'class/editLink.html',{'link_form':link_form, 'class':class_, 'link_id':link_id})
def get(self): # get from ?link_id= in url, or hidden form field link_id = int(self.request.get('link_id')) link = StudentGame.get_by_id(link_id) link_form = StudentGameForm(instance=link) game = link.game doRender(self,'game/editLink.html',{'link_form':link_form, 'game':game, 'link_id':link_id})
def get(self): # get from ?link_id= in url, or hidden form field link_id = int(self.request.get('link_id')) link = StudentInternship.get_by_id(link_id) link_form = StudentInternshipForm(instance=link) internship = link.internship doRender(self,'internship/editLink.html',{'link_form':link_form, 'internship':internship, 'link_id':link_id})
def get(self): # get from ?link_id= in url, or hidden form field link_id = int(self.request.get('link_id')) link = StudentPaper.get_by_id(link_id) link_form = StudentPaperForm(instance=link) paper = link.paper doRender(self,'paper/editLink.html',{'link_form':link_form, 'paper':paper, 'link_id':link_id})
def post(self): form = GameForm(data=self.request.POST) if form.is_valid(): try : game = form.save() self.redirect('/game/view?id=%d' % game.key().id()) except db.BadValueError, e: doRender(self,'game/add.html',{'form':form, 'error': "ERROR: " + e.args[0]})
def post(self): form = ClassForm(self.request.POST) if form.is_valid(): # checks values with validation functions try: cl = form.save() # this calls Class.put(), which checks for missing values self.redirect("/class/view?id=%d" % cl.key().id()) except db.BadValueError, e: doRender(self,'class/add.html',{'form':form, 'error': "ERROR: " + e.args[0]})
def post(self): form = InternshipForm(data=self.request.POST) if form.is_valid(): try : internship = form.save() id = internship.key().id() self.redirect('/internship/view?id=%d' % id) except db.BadValueError, e : doRender(self,'internship/add.html',{'form':form, 'error': "ERROR: " + e.args[0]})
def post(self): xml_string = self.request.get('xml-string') try: xmlImportString(xml_string) except Exception, e: doRender(self,'import.html',{ 'error' : e.args }) # bug - was missing this return statement, so wound up # falling through to next redirect, and not realizing it was failing. return
def post(self): form = PaperForm(data=self.request.POST) if form.is_valid(): try : paper = form.save() id = paper.key().id() self.redirect('/paper/view?id=%d' % id) except db.BadValueError, e: doRender(self,'paper/add.html',{'form':form, 'error': "ERROR: " + e.args[0]})
def post(self): id = int(self.request.get('id')) internship = Internship.get_by_id(id) form = InternshipForm(data=self.request.POST, instance=internship) if form.is_valid(): try: form.save() self.redirect("/internship/list") except db.BadValueError, e: doRender(self, 'internship/add.html', {'form':form, 'id':id, 'error': "ERROR: " + e.args[0]})
def post(self): id = int(self.request.get('id')) cl = Class.get_by_id(id) form = ClassForm(data = self.request.POST, instance = cl) if form.is_valid(): try: form.save() self.redirect("/class/list") except db.BadValueError, e: doRender(self, 'class/add.html', {'form':form, 'id':id, 'error': "ERROR: " + e.args[0]})
def post(self): link_id = int(self.request.get('link_id')) link = StudentClass.get_by_id(link_id) form = StudentClassForm(data = self.request.POST, instance = link) if form.is_valid(): # this checks values against validation functions try: link = form.save() # this calls put, which checks for missing values self.redirect("/profile") except db.BadValueError, e: class_ = link.class_ doRender(self, 'class/editLink.html', {'link_form':form, 'class':class_, 'link_id':link_id, 'error': "ERROR: " + e.args[0]})
def get(self) : self.session = Session() self.session.delete_item('username') s = Student() s.generateID() s.generatePassword() s.put() user = s user.put() self.session['username'] = user.id_ self.session['student_id'] = s.key().id() doRender(self, 'issueAccount.html', {'student' : s})
def get(self): session = Session() if 'student_id' in session: template = {} sb = StudentBook.all() sc = StudentClass.all() sp = StudentPlace.all() si = StudentInternship.all() spa = StudentPaper.all() sg = StudentGame.all() s = Student.get_by_id(session['student_id']) #books sbooks = sb.filter("student =", s) sbooks = sbooks.fetch(98988) template['sbooks'] = sbooks #class sclasses = sc.filter("student =", s) sclasses = sclasses.fetch(98988) template['sclasses'] = sclasses #Place splaces = sp.filter("student = ", s) splaces = splaces.fetch(98988) template['splaces'] = splaces #Internship sinternships = si.filter("student = ", s) sinternships = sinternships.fetch(98988) template['sinternships'] = sinternships #Paper spapers = spa.filter("student = ", s) spapers = spapers.fetch(98988) template['spapers'] = spapers #Game sgames = sg.filter("student = ", s) sgames = sgames.fetch(98988) template['sgames'] = sgames doRender(self,"profile.html", template) else: doRender(self,"profile.html")
def get(self): class_id = int(self.request.get('id')) # get id from "?id=" in url class_ = Class.get_by_id(class_id) link_form = StudentClassForm() links = class_.studentclass_set self.session = Session() if not 'student_id' in self.session: sc = None else: student_id = self.session['student_id'] student = Student.get_by_id(student_id) sc = StudentClass.all().filter("student = ", student) sc = sc.filter("class_ = ", class_) sc = sc.fetch(1) if sc : sc = sc[0] doRender(self,'class/view.html',{'link_form':link_form,'class':class_,'links':links,'id':class_id, 'ratedThis' : sc})
def get(self): id = int(self.request.get('id')) # get id from "?id=" in url internship = Internship.get_by_id(id) form = InternshipForm(instance=internship) assocs = internship.studentinternship_set self.session = Session() if not 'student_id' in self.session: sc = None else: student_id = self.session['student_id'] student = Student.get_by_id(student_id) sc = StudentInternship.all().filter("student = ", student) sc = sc.filter("internship = ", internship) sc = sc.fetch(1) if sc : sc = sc[0] doRender(self,'internship/view.html',{'form':form,'internship':internship,'assocs':assocs,'id':id, 'ratedThis' : sc})
def get(self): id = int(self.request.get('id')) # get id from "?id=" in url game = Game.get_by_id(id) form = GameForm(instance=game) assocs = game.studentgame_set self.session = Session() if not 'student_id' in self.session: sc = None else: student_id = self.session['student_id'] student = Student.get_by_id(student_id) sc = StudentGame.all().filter("student = ", student) sc = sc.filter("game = ", game) sc = sc.fetch(1) if sc : sc = sc[0] doRender(self,'game/view.html',{'form':form,'game':game,'assocs':assocs,'id':id, 'ratedThis' : sc})
def get(self): id = int(self.request.get('id')) # get id from "?id=" in url paper = Paper.get_by_id(id) form = PaperForm(instance=paper) assocs = paper.studentpaper_set self.session = Session() if not 'student_id' in self.session: sc = None else: student_id = self.session['student_id'] student = Student.get_by_id(student_id) sc = StudentPaper.all().filter("student = ", student) sc = sc.filter("paper = ", paper) sc = sc.fetch(1) if sc : sc = sc[0] doRender(self,'paper/view.html',{'form':form,'paper':paper,'assocs':assocs,'id':id, 'ratedThis' : sc})
def post(self): self.session = Session() student_id = self.session['student_id'] student = Student.get_by_id(student_id) class_id = int(self.request.get('_id')) class_ = Class.get_by_id(class_id) link_form = StudentClassForm(self.request.POST) if link_form.is_valid() : try : link = link_form.save(commit = False) link.student = student link.class_ = class_ link.put() self.redirect("/class/list") except db.BadValueError, e : links = class_.studentclass_set doRender(self,'class/view.html',{'link_form':link_form,'class':class_,'links':links,'id':class_id,\ 'error': "ERROR: " + e.args[0]})
def post(self): values = {} self.session = Session() oldPass = self.request.get('oldPass') newPass1 = self.request.get('newPass1') newPass2 = self.request.get('newPass2') username = self.session['username'] user = Student.get_by_username(username) if oldPass != user.password: values['oldPassError'] = True if newPass1 != newPass2: values['mismatch'] = True if oldPass == user.password and newPass1 == newPass2: user.password = newPass1 user.put() values['success'] = True doRender(self,'changePassword.html', values)
def post(self): self.session = Session() id_ = self.request.get('username') pw = self.request.get('password') self.session.delete_item('username') if id_ == '': doRender(self, 'login.html', {'error':'Please specify a username.'}) return if pw == '': doRender(self, 'login.html', {'error':'Please specify a password.'}) return user = Student.get_by_username(id_) if user is None: doRender(self,'login.html',{'error':'Invalid username entered. Please try again. '}) elif pw == user.password: self.session['username'] = id_ self.session['student_id'] = user.key().id() if user.isAdmin: self.session['admin'] = True self.redirect('/profile') else: doRender(self,'login.html',{'error':'Invalid password entered. Please try again.'})
def get(self): id = int(self.request.get('id')) cl = Class.get_by_id(id) doRender(self,'class/delete.html',{'cl':cl,'id':id})
def get(self): id = int(self.request.get('id')) cl = Class.get_by_id(id) doRender(self,'class/add.html',{'form':ClassForm(instance=cl),'id':id})
def get(self): form = ClassForm() doRender(self,'class/add.html',{'form':form})
class AddClass(webapp.RequestHandler): def get(self): form = ClassForm() doRender(self,'class/add.html',{'form':form}) @authenticate def post(self): form = ClassForm(self.request.POST) if form.is_valid(): # checks values with validation functions try: cl = form.save() # this calls Class.put(), which checks for missing values self.redirect("/class/view?id=%d" % cl.key().id()) except db.BadValueError, e: doRender(self,'class/add.html',{'form':form, 'error': "ERROR: " + e.args[0]}) else: doRender(self,'class/add.html',{'form':form, \ 'error':'ERROR: Please correct the following errors and try again.'}) class EditClass(webapp.RequestHandler): def get(self): id = int(self.request.get('id')) cl = Class.get_by_id(id) doRender(self,'class/add.html',{'form':ClassForm(instance=cl),'id':id}) @authenticate_admin def post(self): id = int(self.request.get('id')) cl = Class.get_by_id(id) form = ClassForm(data = self.request.POST, instance = cl) if form.is_valid(): try: form.save()
def get(self): papers = Paper.all() doRender(self,'paper/list.html',{'papers':papers})
def get(self): id = int(self.request.get('id')) paper = Paper.get_by_id(id) doRender(self,'paper/delete.html',{'paper':paper,'id':id})
def get(self): doRender(self,'paper/add.html',{'form':PaperForm()})
def get(self): classes = Class.all() doRender(self,'class/list.html',{'classes':classes})
def get(self): id = int(self.request.get('id')) # get id from "?id=" in url paper = Paper.get_by_id(id) doRender(self,'paper/add.html',{'form':PaperForm(instance=paper),'id':id})