def get(self): for i in range(100): ngo = NGO() ngo.name = str(random.randrange(20, 10000)) ngo.credibility = False ngo.eightygRegistrationNumber = str(random.randrange(1, 10000)) ngo.description = str(random.randrange(1, 100000000000000000000)) ngo.userid = str(random.randrange(1, 1000000)) ngo.email = "*****@*****.**" ngo.put() self.response.write("Done!")
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!")