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 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,10))
			ngo.email = "*****@*****.**"
			ngo.projects=[]
			ngo.put()
		self.response.write("Done!")
Exemple #3
0
    def get(self, urlParameter):
		q = NGO.query(NGO.userid == urlParameter).fetch(1)
		if q:
			parameters = {}
			for p in q:
				parameters["ngo"] = p
			q = Project.query(Project.ngo == urlParameter).fetch(4)
			parameters["projects"] = q
			parameters["p_len"] = len(q)
			q = NGO.query(NGO.userid != urlParameter and NGO.sectorOfOperation == parameters["ngo"].sectorOfOperation).fetch(4)
			parameters["similarNGOs"] = q
			parameters["n_len"] = len(q)
			self.render('ngoPage.html',parameters)
    def get(self, urlParameter):
		q = NGO.query(NGO.userid == urlParameter).fetch(1)
		if q:
			parameters = {}
			for p in q:
				parameters["ngo"] = p
			q = Project.query(Project.ngo == urlParameter).fetch(4)
			parameters["projects"] = q
			parameters["p_len"] = len(q)
			q = NGO.query(NGO.sectorOfOperation == parameters["ngo"].sectorOfOperation).fetch(4)
			p = [n for n in q if n.userid != parameters["ngo"].userid]
			parameters["similarNGOs"] = p
			print q
			parameters["n_len"] = len(p)
			self.render('ngoPage.html',parameters)
 def post(self):
         detailedDescription = self.request.get("detailedDescription")
         
         count=int(self.request.get("count"))
         projectObject = Project()
         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 authenticationNGO:
                         ngo = projectObject.ngo
                         existingProject = Project.query(Project.ngo==userid).fetch(1)
                         if existingProject:
                                 projectObject.detailedDescription = detailedDescription
                                 while count>0:
                                         j=1
                                         Counter=str(count-count+j)
                                         taskTitle = self.request.get("taskTitle"+Counter)
                                         taskDescription = self.request.get("taskDescription"+Counter)
                                         taskFund = self.request.get("taskFund"+Counter)
                                         count=count-1
                                         j=j-1
                                         projectObject.tasks = [TaskList(taskTitle = taskTitle, taskDescription = taskDescription, taskFund = taskFund)]
                                 projectObject.put()
                                 self.redirect("/home")
                         else:
                                 self.redirect("/propose")
                 elif authenticationUser:
                         self.redirect("/home")
                 else:
                         self.redirect("/")
         else:
                 self.redirect("/login")
Exemple #6
0
    def post(self, userid):
        descriptionAuthenticity = self.request.get("descriptionAuthenticity")
        eightygAuthenticity = self.request.get("eightygAuthenticity")
        ngoQuery = NGO.query(NGO.userid == userid)
        ngo = ngoQuery.fetch(1)[0]
        parameter = {}
        if descriptionAuthenticity == "on" and eightygAuthenticity == "on":
            mail.send_mail(
                sender=" <*****@*****.**>",
                to="<" + ngo.email + ">",
                subject="Your NGO has been approved",
                body="""Dear :""" + ngo.name +
                """\nYour csr.com account has been approved.  You can now visit http://www.csr.com/ and sign in using your Google Account to access new features.Please let us know if you have any questions.The csr.com Team		"""
            )
            ngo.credibility = True
            ngo.put()
            parameter["message"] = "Success Mail Sent!"
            self.render("responseAdmin.html", parameter)

        else:
            failiureReport = "\nPlaces where your ngo failed\n"
            if descriptionAuthenticity != "on":
                failiureReport += " The Description you provided isnt apt for a site like us.\n"
            elif eightygAuthenticity != "off":
                failiureReport += " Your 80G no isnt valid\n"
            mail.send_mail(
                sender=" <*****@*****.**>",
                to="<" + ngo.email + ">",
                subject="Your NGO has failed authentication test",
                body="""Dear :""" + ngo.name + failiureReport +
                """Please let us know if you have any questions.The csr.com Team"""
            )
            parameter["message"] = "Failure Report Sent!"
            self.render("responseAdmin.html", parameter)
	def get(self):
		user=users.get_current_user()
		try:
			hitCount = HitCount.query().fetch(1)[0]
			hits = int(hitCount.hitCount) + 1
		except:
			hits = 0
			hitCount = HitCount()
		hitCount.hitCount = str(hits)
		hitCount.put()
		if user:
			userid = user.user_id()
 	    		userAuthenticationQuery = User.query(User.userid == userid).fetch(1)	 	    	      
                        NGOauthenticationQuery = NGO.query(NGO.userid == userid).fetch(1)
                        if (not userAuthenticationQuery) and (not NGOauthenticationQuery) :
				self.redirect("/signup/registration")
		projects = Project.query().fetch()
		randProjects = []
		try:
			for i in range(0,4):
				randomInt = randint(0,len(projects)-1)
				if projects[randomInt] not in randProjects:
					randProjects.append(projects[randomInt])
		except:
			pass
		parameter = {"projects" : randProjects, "hits":hits}
		self.render('frontPage.html', parameter)        
	def post(self, userid):
		descriptionAuthenticity = self.request.get("descriptionAuthenticity")			
		eightygAuthenticity = self.request.get("eightygAuthenticity")
		ngoQuery = NGO.query(NGO.userid == userid)
                ngo = ngoQuery.fetch(1)[0]
		parameter = {}
		if descriptionAuthenticity == "on" and eightygAuthenticity == "on":
			mail.send_mail(sender=" <*****@*****.**>",
    					          to= "<"+ngo.email+">",
              					subject="Your NGO has been approved",
              					body="""Dear :"""+ngo.name+"""\nYour csr.com account has been approved.  You can now visit http://www.csr.com/ and sign in using your Google Account to access new features.Please let us know if you have any questions.The csr.com Team		""")			
			ngo.credibility = True
			ngo.put()	
			parameter["message"]= "Success Mail Sent!"
			self.render("responseAdmin.html", parameter)

		else:
			failiureReport = "\nPlaces where your ngo failed\n"
			if descriptionAuthenticity != "on":	
				failiureReport+=" The Description you provided isnt apt for a site like us.\n"
			elif eightygAuthenticity != "off": 
				failiureReport+=" Your 80G no isnt valid\n"
			mail.send_mail(sender=" <*****@*****.**>",
                                                  to= "<"+ngo.email+">",
                                                subject="Your NGO has failed authentication test",
                                                body="""Dear :"""+ ngo.name + failiureReport +"""Please let us know if you have any questions.The csr.com Team""")
			parameter["message"] = "Failure Report Sent!"
			self.render("responseAdmin.html", parameter)
Exemple #9
0
	def get(self):
		user=users.get_current_user()
		if user:
			userid = user.user_id()
			userAuth = User.query(User.userid == userid).fetch(1)
			ngoAuth = NGO.query(NGO.userid == userid).fetch(1)
			if userAuth:
				userProj = []
				link = userAuth[0].projects
				for p in link:
					ngo, title = p[0].split("_")
					projects = ndb.gql("SELECT * FROM Project WHERE link = :1 AND ngo = :2", title,ngo).fetch(1)
					if projects:
						userProj.append((projects[0],p[1]));
						print userProj
				parameter = {"proj":userProj, "user": 1, "length":len(userProj)}
				self.render("/userProjects.html",parameter)
			elif ngoAuth:
				ngoProjects = []
				link = ngoAuth[0].projects
				for p in link:
					proj = Project.query(Project.ngo == p.userid).fetch(1)
					ngoProjects.append(proj[0]);
				parameter = {"projects":ngoProjects, "user": 0, "length":len(ngoProjects),"ngo":ngoAuth[0]}
				self.render("/ngoProjects.html",parameter)
		else:
			self.render("/login.html")
 def get(self):
     user = users.get_current_user()
     try:
         hitCount = HitCount.query().fetch(1)[0]
         hits = int(hitCount.hitCount) + 1
     except:
         hits = 0
         hitCount = HitCount()
     hitCount.hitCount = str(hits)
     hitCount.put()
     if user:
         userid = user.user_id()
         userAuthenticationQuery = User.query(
             User.userid == userid).fetch(1)
         NGOauthenticationQuery = NGO.query(NGO.userid == userid).fetch(1)
         if (not userAuthenticationQuery) and (not NGOauthenticationQuery):
             self.redirect("/signup/registration")
     projects = Project.query().fetch()
     randProjects = []
     try:
         for i in range(0, 4):
             randomInt = randint(0, len(projects) - 1)
             if projects[randomInt] not in randProjects:
                 randProjects.append(projects[randomInt])
     except:
         pass
     parameter = {"projects": randProjects, "hits": hits}
     self.render('frontPage.html', parameter)
Exemple #11
0
	def get(self):
		user=users.get_current_user()
		if user:
			userid = user.user_id()
			userAuth = User.query(User.userid == userid).fetch(1)
			ngoAuth = NGO.query(NGO.userid == userid).fetch(1)
			if userAuth:
				userProj = []
				link = userAuth[0].projects
				for p in link:
					ngo, title = p[0].split("_")
					projects = ndb.gql("SELECT * FROM Project WHERE link = :1 AND ngo = :2", title,ngo).fetch(1)
					if projects:
						userProj.append((projects[0],p[1]));
						print userProj
				parameter = {"proj":userProj, "user": 1, "length":len(userProj)}
				self.render("/userProjects.html",parameter)
			elif ngoAuth:
				ngoProjects = []
				ngoAuth
				for p in ngoAuth:
					proj = Project.query(Project.ngo == p.userid).fetch(1)
					ngoProjects.append(proj[0]);
				print ngoAuth[0]
				parameter = {"ngoProjects":ngoProjects, "user": 0, "length":len(ngoProjects),"ngo":ngoAuth[0]}
				self.render("/ngoProjects.html",parameter)
		else:
			self.render("/login.html")
 def post(self):
         detailedDescription = self.request.get("detailedDescription")
         
         count=int(self.request.get("count"))
         projectObject = Project()
         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 authenticationNGO:
                         ngo = projectObject.ngo
                         existingProject = Project.query(Project.ngo==userid).fetch(1)
                         if existingProject:
                                 projectObject.detailedDescription = detailedDescription
                                 while count>0:
                                         j=1
                                         Counter=str(count-count+j)
                                         taskTitle = self.request.get("taskTitle"+Counter)
                                         taskDescription = self.request.get("taskDescription"+Counter)
                                         taskFund = self.request.get("taskFund"+Counter)
                                         count=count-1
                                         j=j-1
                                         projectObject.tasks = [TaskList(taskTitle = taskTitle, taskDescription = taskDescription, taskFund = taskFund)]
                                 projectObject.put()
                                 self.redirect("/home")
                         else:
                                 self.redirect("/propose")
                 elif authenticationUser:
                         self.redirect("/home")
                 else:
                         self.redirect("/")
         else:
                 self.redirect("/login")
        def post(self, urlParameter):
		ngoUserid, title = urlParameter.split("_")
                descriptionAuthenticity = self.request.get("descriptionAuthenticity")
                projectQuery = Project.query(Project.ngo == ngoUserid, Project.title == title)
		ngoQuery = NGO.query(NGO.userid == ngoUserid)
		ngo = ngoQuery.fetch(1)[0]
                project = projectQuery.fetch(1)[0]
		parameter = {}
                if descriptionAuthenticity == "on":
                        mail.send_mail(sender=" <*****@*****.**>",
                                       	          to= "<"+ngo.email+">",
	                                         	subject="Your Project  has passed authentication test",
	                                                body="""Dear :"""+ ngo.name + "Your Project titled '"+project.title+"' has passed authentication and goes live!\n" +"""Please let us know if you have any questions.The csr.com Team""")
			project.authenticity = True
			project.put()
			parameter["message"]= "Success Mail Sent!"
   		        self.render("responseAdmin.html", parameter)


                else:
                	failiureReport = "\nPlaces where your project failed\n"
                        failiureReport += " The Description you provided isnt apt for a site like us.\n"
                        mail.send_mail(sender=" <*****@*****.**>", to= "<"+ngo.email+">", subject="Your Project has failed authentication test",body="""Dear :"""+ ngo.name + failiureReport +"""Please let us know if you have any questions. \nThe csr.com Team""")

			parameter["message"]= "Failure Report Sent!"
        	        self.render("responseAdmin.html", parameter)
Exemple #14
0
 def get(self):
     user = users.get_current_user()
     if user:
         userid = user.user_id()
         userAuthentication = User.query(User.userid == userid).fetch(1)
         ngoAuthentication = NGO.query(NGO.userid == userid).fetch(1)
         if userAuthentication:
             parameter = {}
             ngos = NGO.query().fetch(4)
             userObject = userAuthentication[0]
             userProjects = []
             for p in userObject.projects:
                 ngo, title = p[0].split("_")
                 print p[0]
                 proj = ndb.gql(
                     "SELECT * FROM Project WHERE link = :1 AND ngo = :2",
                     title, ngo).fetch(1)
                 if proj:
                     userProjects.append(proj[0])
             projects = Project.query().fetch(100)
             print userObject.projects
             closeProjects = []
             decorated = [(project,
                           project.distance(userAuthentication[0].lat,
                                            userAuthentication[0].lng))
                          for project in projects]
             closeProjects = sorted(decorated, key=lambda tup: tup[1])[0:4]
             parameter["projects"] = closeProjects
             parameter["userProjects"] = userProjects
             parameter["ngos"] = ngos
             parameter["currUser"] = userAuthentication[0]
             self.render("userHomePage.html", parameter)
         elif ngoAuthentication:
             parameter = {}
             proj = Project.query(
                 Project.ngo == ngoAuthentication[0].userid).fetch()
             parameter["ngoProjects"] = proj
             parameter["length"] = len(proj)
             parameter["ngo"] = ngoAuthentication[0]
             self.render("ngoHomePage.html", parameter)
         else:
             self.redirect("/signup/registration")
     else:
         self.redirect("/")
Exemple #15
0
	def get(self, urlParameter):
		ngo, title = urlParameter.split("_")
		q = ndb.gql("SELECT * FROM Project WHERE link = :1 AND ngo = :2", title,ngo).fetch(1)
		if q:
			parameters = {}
			for p in q:
				ngoP = NGO.query(NGO.userid == p.ngo).fetch(1)
				parameters["ngo"] = ngoP[0]
				parameters["project"] = p
			self.render('fund.html',parameters)
Exemple #16
0
	def get(self, urlParameter):
		ngo, title = urlParameter.split("_")
		q = ndb.gql("SELECT * FROM Project WHERE link = :1 AND ngo = :2", title,ngo).fetch(1)
		if q:
			parameters = {}
			for p in q:
				ngoP = NGO.query(NGO.userid == p.ngo).fetch(1)
				parameters["ngo"] = ngoP[0]
				parameters["project"] = p
			self.render('fund.html',parameters)
        def get(self):
                user=users.get_current_user()
		if user:
			userid = user.user_id()
                        NGOauthenticationQuery = NGO.query(NGO.userid == userid).fetch(1)	 	    	      
			if not NGOauthenticationQuery :
				self.redirect("/signup/registration")
			else:
				self.render("propose.html")
		else:
                        self.redirect("/login")
Exemple #18
0
	def get(self):
		user=users.get_current_user()
		if user:
			userid = user.user_id()
 	    		userAuthenticationQuery = User.query(User.userid == userid).fetch(1)	 	    	      
                        NGOauthenticationQuery = NGO.query(NGO.userid == userid).fetch(1)
                        if (not userAuthenticationQuery) and (not NGOauthenticationQuery) :
				self.redirect("/signup/registration")
		projects = Project.query().fetch(3)
		parameter = {"projects" : projects }
		self.render('frontPage.html', parameter)        
Exemple #19
0
 def get(self):
     user = users.get_current_user()
     if user:
         userid = user.user_id()
         NGOauthenticationQuery = NGO.query(NGO.userid == userid).fetch(1)
         if not NGOauthenticationQuery:
             self.redirect("/signup/registration")
         else:
             self.render("propose.html")
     else:
         self.redirect("/login")
Exemple #20
0
	def get(self):
		user=users.get_current_user()
		if user:
			userid = user.user_id()
 			authenticationUser = NGO.query(NGO.userid == userid).fetch(1)
			if  not authenticationUser:
				
				self.render("ngoRegistration.html")
			else:
				self.redirect("/home")
		else:
			self.redirect("/login")
Exemple #21
0
    def get(self):
        user = users.get_current_user()
        if user:
            userid = user.user_id()
            authenticationUser = NGO.query(NGO.userid == userid).fetch(1)
            if not authenticationUser:

                self.render("ngoRegistration.html")
            else:
                self.redirect("/home")
        else:
            self.redirect("/login")
Exemple #22
0
	def get(self):
		user = users.get_current_user()
		if user:
			userid = user.user_id()
			userAuthentication =  User.query(User.userid == userid).fetch(1)
			ngoAuthentication = NGO.query(NGO.userid == userid).fetch(1)
			if userAuthentication:
				parameter = {}
				ngos = NGO.query().fetch(4)
				userObject = userAuthentication[0]
				userProjects = []
				for p in userObject.projects:
					ngo, title = p[0].split("_")
					print p[0]
					proj = ndb.gql("SELECT * FROM Project WHERE link = :1 AND ngo = :2", title,ngo).fetch(1)
					if proj:
						userProjects.append(proj[0]);
				projects = Project.query().fetch(100)
				print userObject.projects
				cProjects = []
				decorated = [(project,project.distance(userAuthentication[0].lat,userAuthentication[0].lng)) for project in projects if project.distance(userAuthentication[0].lat,userAuthentication[0].lng)<50]
				print decorated
				cProjects = sorted(decorated, key=lambda tup: tup[1])[0:4] 
				parameter["cProjects"] = cProjects
				parameter["userProjects"] = userProjects 
				parameter["ngos"] = ngos
				parameter["currUser"] = userAuthentication[0]
				self.render("userHomePage.html", parameter)
			elif ngoAuthentication:
				parameter={}
				proj = Project.query(Project.ngo == ngoAuthentication[0].userid).fetch()
                                parameter["ngoProjects"] = proj
                                parameter["length"] = len(proj)
                                parameter["ngo"]=ngoAuthentication[0]
				self.render("ngoHomePage.html", parameter)
			else:
				self.redirect("/signup/registration")
		else:
			self.redirect("/")
Exemple #23
0
	def get(self):
		user = users.get_current_user()
		if user:
			userid = user.user_id()
			userAuthentication =  User.query(User.userid == userid).fetch(1)
			ngoAuthentication = NGO.query(NGO.userid == userid).fetch(1)
			if userAuthentication:
				parameter = {}
				ngos = NGO.query().fetch(3)
				userObject = userAuthentication[0]
                                projectsIdentifier = userObject.projects[:3]
                                userProjects = []
                                for projectIdentifier in projectsIdentifier:
                                        key = ndb.Key("Project", projectIdentifier)
                                        userProjects.append(key.get())
				projects = Project.query().fetch(3)
                                parameter["projects"] = projects
				parameter["userProjects"] = userProjects 
				parameter["ngos"] = ngos
				self.render("userHomePage.html", parameter)
			elif ngoAuthentication:
				parameter={}
                                ngo = ngoAuthentication[0]
                                projectsIdentifierList = ngo.projects
                                ngoProjects = []
				if projectsIdentifierList:
                             		for projectIdentifier in projectsIdentifierList:
                                	        ngo, title = self.stripProjectIdentifier(projectIdentifier)
                                       	        projectObject = Project.query(Project.ngo == ngo, Project.title == title).fetch(1)[0]
                                        	ngoProjects.append(projectObject)
                                parameter["ngoProjects"] = ngoProjects
				self.render("ngoHomePage.html", parameter)
			else:
				self.redirect("/signup/registration")
		else:
			self.redirect("/")
Exemple #24
0
 def post(self):
     user = users.get_current_user()
     if user:
         ngo = NGO.query(NGO.userid == user.user_id()).fetch(1)[0]
         if ngo:
             eightygRegistration = self.get_uploads("eightygRegistration")
             proofOfRegistration = self.get_uploads("proofOfRegistration")
             if not ngo.eightygRegistration:
                 ngo.eightygRegistration = eightygRegistration[0].key()
             if not ngo.proofOfRegistration:
                 ngo.proofOfRegistration = proofOfRegistration[0].key()
             ngo.put()
         else:
             self.redirect("/signup/registration")
     else:
         self.redirect("/login")
Exemple #25
0
	def post(self):
		user = users.get_current_user()
		if user:
			ngo = NGO.query(NGO.userid == user.user_id()).fetch(1)[0]
			if ngo:
				eightygRegistration = self.get_uploads("eightygRegistration")
				proofOfRegistration = self.get_uploads("proofOfRegistration")
				if not ngo.eightygRegistration:
					ngo.eightygRegistration = eightygRegistration[0].key() 
				if not ngo.proofOfRegistration:
					ngo.proofOfRegistration = proofOfRegistration[0].key()	
				ngo.put()
			else: 
				self.redirect("/signup/registration")
		else:
			self.redirect("/login")
 def get(self, urlParameter):
     print urlParameter
     ngo, title = urlParameter.split("_")
     q = ndb.gql("SELECT * FROM Project WHERE link = :1 AND ngo = :2",
                 title, ngo).fetch(1)
     funds = 0
     print q
     if q:
         parameters = {}
         for p in q:
             parameters["project"] = p
             ngoP = NGO.query(NGO.userid == p.ngo).fetch(1)
             parameters["ngo"] = ngoP[0]
         for task in parameters["project"].tasks:
             funds = funds + int(task[2])
         i = 0
         parameters["collected"] = 0
         parameters["funding"] = []
         while i < len(parameters["project"].funding):
             user = User.query(User.userid ==
                               parameters["project"].funding[i][0]).fetch(1)
             parameters["collected"] = parameters["collected"] + int(
                 parameters["project"].funding[i][1])
             parameters["funding"].append(
                 (user[0], parameters["project"].funding[i][1]))
             i = i + 1
         parameters["funding"].reverse()
         print parameters["project"].funding
         parameters["support"] = i
         print parameters["support"]
         projects = Project.query(
             Project.category == parameters["project"].category).fetch()
         closeProjects = []
         try:
             for i in range(0, 4):
                 randomInt = randint(0, len(projects) - 1)
                 if (projects[randomInt] not in closeProjects
                         and projects[randomInt] != parameters["project"]):
                     closeProjects.append(projects[randomInt])
         except:
             pass
         parameters["closeProjects"] = closeProjects
         parameters["funds"] = funds
         self.render("projectPage.html", parameters)
Exemple #27
0
	def get(self):
		user = users.get_current_user()
		if user:
			userid = user.user_id()
			userAuthentication = NGO.query(NGO.userid == userid).fetch(1)
			if userAuthentication:
				parameter={}
				ngo = userAuthentication[0]
				projectsIdentifierList = ngo.projects
				projects = []
				for projectIdentifier in projectsIdentifierList:
					ngo, title = self.stripProjectIdentifier(projectIdentifier)
					projectObject = Project.query(Project.ngo == ngo, Project.title == title).fetch(1)[0]
					projects.append(projectObject)
				parameter["projects"] = projects
				self.render("updateProject.html", parameter)
			else:
				self.redirect("/")	
		else:
			self.redirect("/login")
Exemple #28
0
    def get(self):
        user = users.get_current_user()
        if user:
            userid = user.user_id()
            ngo = NGO.query(NGO.userid == userid).fetch(1)[0]
            if ngo:
                name = ngo.name
                description = ngo.description
                panCardNumber = ngo.pancardNumber
                if name and description and panCardNumber:
                    upload_url = blobstore.create_upload_url("/signup/upload")
                    parameter = {'upload_url': upload_url}
                    self.render("ngoRegistrationUpload.html", parameter)
                else:
                    self.redirect("/signup/ngoRegistration")
            else:
                self.redirect("/signup/ngoRegistration")

        else:
            self.redirect("/login")
Exemple #29
0
	def get(self):
		user = users.get_current_user()
		if user:
			userid = user.user_id()
			userAuthentication = NGO.query(NGO.userid == userid).fetch(1)
			if userAuthentication:
				parameter={}
				ngo = userAuthentication[0]
				projectsIdentifierList = ngo.projects
				projects = []
				for projectIdentifier in projectsIdentifierList:
					ngo, title = self.stripProjectIdentifier(projectIdentifier)
					projectObject = Project.query(Project.ngo == ngo, Project.title == title).fetch(1)[0]
					projects.append(projectObject)
				parameter["projects"] = projects
				self.render("updateProject.html", parameter)
			else:
				self.redirect("/")	
		else:
			self.redirect("/login")
Exemple #30
0
	def get(self):
		user = users.get_current_user()
		if user:
			userid = user.user_id()
			ngo = NGO.query(NGO.userid == userid).fetch(1)[0]
			if ngo:
				name = ngo.name
				description = ngo.description
				panCardNumber = ngo.pancardNumber
				if name and description and panCardNumber:
					upload_url = blobstore.create_upload_url("/signup/upload")
					parameter = {'upload_url':upload_url}
					self.render("ngoRegistrationUpload.html",parameter)
				else:
					self.redirect("/signup/ngoRegistration")
			else:
				self.redirect("/signup/ngoRegistration")

		else:
			self.redirect("/login")
Exemple #31
0
    def get(self,urlParameter):
		print urlParameter
		ngo, title = urlParameter.split("_")
		q = ndb.gql("SELECT * FROM Project WHERE link = :1 AND ngo = :2", title,ngo).fetch(1)
		funds = 0
		print q
		if q:
			parameters = {}
			for p in q:
				parameters["project"] = p
				ngoP = NGO.query(NGO.userid == p.ngo).fetch(1)
				parameters["ngo"] = ngoP[0]
			for task in parameters["project"].tasks:
				funds = funds + int(task[2]);
			i=0
			parameters["collected"] = 0
			parameters["funding"] = []
			while i < len(parameters["project"].funding):
				user = User.query(User.userid == parameters["project"].funding[i][0]).fetch(1)
				parameters["collected"] = parameters["collected"] + int(parameters["project"].funding[i][1])
				parameters["funding"].append((user[0], parameters["project"].funding[i][1]))
				i=i+1
			parameters["funding"].reverse()
			print parameters["project"].funding
			parameters["support"]=i
			print parameters["support"]
			projects = Project.query(Project.category == parameters["project"].category).fetch()
			closeProjects = []
			try:
				for i in range(0,4):
					randomInt = randint(0,len(projects)-1)
					if(projects[randomInt] not in closeProjects and projects[randomInt] != parameters["project"]):
						closeProjects.append(projects[randomInt])
			except:
				pass
			parameters["closeProjects"] = closeProjects
			parameters["funds"] = funds
			self.render("projectPage.html", parameters)
Exemple #32
0
    def post(self, urlParameter):
        ngoUserid, title = urlParameter.split("_")
        descriptionAuthenticity = self.request.get("descriptionAuthenticity")
        projectQuery = Project.query(Project.ngo == ngoUserid,
                                     Project.title == title)
        ngoQuery = NGO.query(NGO.userid == ngoUserid)
        ngo = ngoQuery.fetch(1)[0]
        project = projectQuery.fetch(1)[0]
        parameter = {}
        if descriptionAuthenticity == "on":
            mail.send_mail(
                sender=" <*****@*****.**>",
                to="<" + ngo.email + ">",
                subject="Your Project  has passed authentication test",
                body="""Dear :""" + ngo.name + "Your Project titled '" +
                project.title +
                "' has passed authentication and goes live!\n" +
                """Please let us know if you have any questions.The csr.com Team"""
            )
            project.authenticity = True
            project.put()
            parameter["message"] = "Success Mail Sent!"
            self.render("responseAdmin.html", parameter)

        else:
            failiureReport = "\nPlaces where your project failed\n"
            failiureReport += " The Description you provided isnt apt for a site like us.\n"
            mail.send_mail(
                sender=" <*****@*****.**>",
                to="<" + ngo.email + ">",
                subject="Your Project has failed authentication test",
                body="""Dear :""" + ngo.name + failiureReport +
                """Please let us know if you have any questions. \nThe csr.com Team"""
            )

            parameter["message"] = "Failure Report Sent!"
            self.render("responseAdmin.html", parameter)
Exemple #33
0
 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!")
Exemple #34
0
 def get(self, userid):
     parameter = {}
     ngoQuery = NGO.query(NGO.userid == userid)
     ngo = ngoQuery.fetch(1)
     parameter["ngoList"] = ngo
     self.render("adminCredibilityCheckNGOPage.html", parameter)
Exemple #35
0
 def get(self):
     parameter = {}
     ngoQuery = NGO.query(NGO.credibility == False)
     ngoList = ngoQuery.fetch(10)
     parameter["ngoList"] = ngoList
     self.render("adminCredibilityCheck.html", parameter)
	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!")
Exemple #37
0
	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 get(self, userid):
		parameter = {}
		ngoQuery = NGO.query(NGO.userid == userid)	
		ngo = ngoQuery.fetch(1)
		parameter["ngoList"] = ngo
		self.render("adminCredibilityCheckNGOPage.html", parameter)
Exemple #39
0
    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")
                Search = self.request.get("name").lower()
                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")
                website = website.replace("http://", "")
                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.search = Search
                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 get(self):
		parameter = {}
		ngoQuery = NGO.query(NGO.credibility == False)
		ngoList = ngoQuery.fetch(10)
		parameter["ngoList"] = ngoList			
		self.render("adminCredibilityCheck.html", parameter)