def post(self): user= users.get_current_user() if user: userid = user.user_id() authenticationUser = User.query(User.userid == userid).fetch(1) authenticationNgo = NGO.query(NGO.userid == userid).fetch(1) if authenticationUser or authenticationNgo: self.redirect("/home") else: name = self.request.get("name") email = user.email() description = self.request.get("description") pancardNumber = self.request.get("pancardNumber") chiefFunctionary = self.request.get("chiefFunctionary") chairman = self.request.get("chairman") sectorOfOperation = self.request.get("sectorOfOperation") stateOfOperation = self.request.get("stateOfOperation") email = self.request.get("email") website = self.request.get("website") registrationNumber = self.request.get("registrationNumber") dateOfRegistration = self.request.get("dateOfRegistration") stateOfRegistration = self.request.get("stateOfRegistration") telephone = self.request.get("telephone") address = self.request.get("address") dateOfRegistration = self.date(dateOfRegistration) ngo = NGO() ngo.userid = userid ngo.name = name ngo.credibility = False ngo.description = description ngo.pancardNumber = pancardNumber ngo.email = email ngo.website = website ngo.chiefFunctionary = chiefFunctionary ngo.chairman = chairman ngo.sectorOfOperation = sectorOfOperation ngo.stateOfOperation = stateOfOperation ngo.registrationNumber = registrationNumber ngo.dateOfRegistration = dateOfRegistration ngo.stateOfRegistration = stateOfRegistration ngo.telephone = telephone ngo.projects = [] ngo.address = address ngo.email = email ngo.put() index = search.Index(name = "NGO") document = search.Document(doc_id = userid, fields = [ search.TextField(name = "name", value = name ), search.TextField(name = "description", value = description), search.TextField(name = "state", value = stateOfRegistration)]) try: index.put(document) except search.Error: logging.exception("Put Failed") sleep(5) #cheap trick but none the less it works! self.redirect("/home") else: self.redirect("/login")
def post(self): user= users.get_current_user() if user: userid = user.user_id() authenticationUser = User.query(User.userid == userid).fetch(1) authenticationNgo = NGO.query(NGO.userid == userid).fetch(1) if authenticationUser or authenticationNgo: self.redirect("/home") else: name = self.request.get("name") email = user.email() description = self.request.get("description") pancardNumber = self.request.get("pancardNumber") chiefFunctionary = self.request.get("chiefFunctionary") chairman = self.request.get("chairman") sectorOfOperation = self.request.get("sectorOfOperation") stateOfOperation = self.request.get("stateOfOperation") registrationNumber = self.request.get("registrationNumber") dateOfRegistration = self.request.get("dateOfRegistration") stateOfRegistration = self.request.get("stateOfRegistration") telephone = self.request.get("telephone") address = self.request.get("address") dateOfRegistration = self.date(dateOfRegistration) ngo = NGO() ngo.userid = userid ngo.name = name ngo.credibility = False ngo.description = description ngo.pancardNumber = pancardNumber ngo.chiefFunctionary = chiefFunctionary ngo.chairman = chairman ngo.sectorOfOperation = sectorOfOperation ngo.stateOfOperation = stateOfOperation ngo.registrationNumber = registrationNumber ngo.dateOfRegistration = dateOfRegistration ngo.stateOfRegistration = stateOfRegistration ngo.telephone = telephone ngo.projects = [] ngo.address = address ngo.email = email ngo.put() index = search.Index(name = "NGO") document = search.Document(doc_id = userid, fields = [ search.AtomField(name = "name", value = name ), search.TextField(name = "description", value = description)]) try: index.put(document) except search.Error: logging.exception("Put Failed") sleep(5) #cheap trick but none the less it works! self.redirect("/signup/ngoRegistration/proofOfRegistration") else: self.redirect("/login")
def get(self): for i in range(100): ngo = NGO() ngo.userid = str(random.randrange(1000, 10000)) ngo.name = "TG" ngo.credibility = False ngo.description = "" ngo.email = "" ngo.pancardNumber = "" ngo.dateOfRegistration = datetime.datetime.now() ngo.stateOfRegistration = "" ngo.chiefFunctionary = "" ngo.chairman = "" ngo.stateOfOperation = "" ngo.sectorOfOperation = "ap" ngo.address = "" ngo.telephone = "122" ngo.registrationNumber = "1234" ngo.put() self.response.write("Done!")
def get(self): for i in range(100): ngo = NGO() ngo.userid = str(random.randrange(1000,10000)) ngo.name = "TG" ngo.credibility = False ngo.description = "" ngo.email = "" ngo.pancardNumber = "" ngo.dateOfRegistration = datetime.datetime.now() ngo.stateOfRegistration = "" ngo.chiefFunctionary = "" ngo.chairman = "" ngo.stateOfOperation = "" ngo.sectorOfOperation = "ap" ngo.address = "" ngo.telephone = "122" ngo.registrationNumber = "1234" ngo.put() self.response.write("Done!")