Exemplo n.º 1
0
    def get(self):
        restrictionList = list()

        maxPrice = self.request.get("maxPrice")
        brandName = self.request.get("brand")
        clothingType = self.request.get("clothingType")

        if brandName == "":
            brandName = None
        if clothingType == "":
            clothingType = None

        try:
            maximumPrice = int(maxPrice)
        except:
            maximumPrice = None

        restrictionList.append(maximumPrice)
        restrictionList.append(brandName)
        restrictionList.append(clothingType)

        user_id = self.session.get("user_id")
        images = imagesModel.getImages(user_id, restrictionList)

        params = {user_id: user_id, images: images}
        app_global.render_template(self, "gallery2.html", params)
Exemplo n.º 2
0
 def get(self):
     restrictionList = list()
     
     maxPrice = self.request.get('maxPrice')
     brandName = self.request.get('brand')
     clothingType = self.request.get('clothingType')
     
     if brandName == "":
         brandName = None
     if clothingType == "":
         clothingType = None
     
     try:
         maximumPrice = int(maxPrice)
     except:
         maximumPrice = None
         
     restrictionList.append(maximumPrice)
     restrictionList.append(brandName)
     restrictionList.append(clothingType)
     
     user_id = self.session.get('user_id')
     images = imagesModel.getImages(user_id, restrictionList)
     photosYouLiked = imagesModel.imagesYouLiked(user_id)
     
     
     
     params = {
         user_id: user_id,
         images: images,
         yourLikedPhotos: photosYouLiked
     }
     app_global.render_template(self,'profile.html', params)    
Exemplo n.º 3
0
 def get(self):
     params = {
         'user': app_global.unicode(self.session.get('user')),
         'user_id': app_global.unicode(self.session.get('user_id')),
         'email': app_global.unicode(self.session.get('email'))
         
     }
     app_global.render_template(self, 'newUserSuccess.html', params)
Exemplo n.º 4
0
 def get(self):
     # images = imagesModels.getImages()
     
     
     params = {
         'user_id': self.session.get('user_id')      
     }
     
     app_global.render_template(self,'tempCloth.html', params)
Exemplo n.º 5
0
 def get(self):                                                  # /userFunctions
     user = app_global.unicode(self.session.get('user'))
     message = self.request.get('message')
     
     params = {
         'user': user,
         'user_id': self.session.get('user_id'),
         'message': message
     }
     
     userModel.getUsers()
     
     
     app_global.render_template(self, 'login.html', params)
Exemplo n.º 6
0
 def get(self):
     # images = imagesModels.getImages()
     
     
     params = {
         'page': '',
         'logo':'pitt_logo.png',
         'photo_name':'photo3.jpg', 
         'photo_name2':'banner2.jpg',
         'photo_name3':'banner1.jpg',
         'user': app_global.unicode(self.session.get('user')),
         'user_id': app_global.unicode(self.session.get('user_id'))
      }
     
     app_global.render_template(self,'index.html', params)
Exemplo n.º 7
0
    def post(self):
        imgURL = self.request.get('imgURL');
        imgID = self.request.get('imgID');


        user_id = app_global.unicode(self.session.get('user_id'))
        user = app_global.unicode(self.session.get('user'))

        params = {
            'user_id': user_id,
            'page': 'profile',
            'user': user,
            'imgURL': imgURL,
            'imgID': imgID
        }

        app_global.render_template(self,'addItems.html', params)
Exemplo n.º 8
0
    def get(self):
        
        user_id = app_global.unicode(self.session.get('user_id'))
        user = app_global.unicode(self.session.get('user'))
        description = app_global.unicode(self.session.get('description'))
        gender = app_global.unicode(self.session.get('gender'))
        email = app_global.unicode(self.session.get('email'))

        params = {
            'user_id': user_id,
            'user': user,
            'description': description,
            'gender': gender,
            'email': email
        }

 
        app_global.render_template(self,'updateprofile.html', params)
Exemplo n.º 9
0
def testGetImages(self):
    images = Image.query().fetch()
    app_global.render_template(self,'test.html', {'images':images})
Exemplo n.º 10
0
    def post(self):
        method = self.request.get('method')
        email = self.request.get('email').strip()   # unique identifier
        un = self.request.get('un').strip()         # name, identifier of person
        pw = self.request.get('pw').strip()
        pw2 = self.request.get('pw2').strip()
        gen = self.request.get('gender').strip()

        
        if method!='logout' and (email == '' or pw ==''):
            message = 'ERROR: You must fill out both email and password!'
            self.redirect('/user?message='+message)
            
        else:
            if method == 'newUser':                                 # /userFunctions?method=newUser
                #check that username does not already exist
                if len(userModel.getUser(email, pw)) > 0:
                    message = 'ERROR: Username already exist!'
                    self.redirect('/user?message='+message)
                elif pw != pw2:
                    message = 'ERROR: Passwords does not match each other'
                    self.redirect('/user?message='+message)
                else:
                    user_key = userModel.createNewUser(email, un, pw, gen)
                    mail.send_mail('*****@*****.**', email, 'Registration', 'Thanks for registering with Pitt Fashion Share! Your account is now active.')
                    self.session['user'] = un
                    self.session['user_id'] = user_key.id()
                    self.session['pass'] = pw
                    self.session['email'] = email
                    self.session['gender'] = gen
         
                    self.redirect('/newUserSuccess')

                    
                    user = userModel.getUser(email, pw)
                    
                    # log newly registered user in
                    self.session['user'] = str(un),
                    self.session['email'] = str(email),
                    self.session['user_id'] = user_key.id()
                    self.session['imgURL'] = '/images/profile.jpg'
                    
                    params = {
                        'user': str(un),
                        'email': str(email)
                    }
                    
                    app_global.render_template(self, 'newUserSuccess.html', params)

                    self.redirect('/newUserSuccess')

  
            elif method == 'login':                                  # /userFunctions?method=login
                user = userModel.getUser(email, pw)
                
                if len(user) > 0:    # user login success
                    template = 'profile.html'
                    message = 'Logged in as ' + user[0].un
                    
                    self.session['email'] = user[0].email,
                    self.session['user'] = user[0].un,
                    self.session['user_id'] = user[0].user_id
                    self.session['description'] = user[0].description
                    self.session['gender'] = user[0].gender
                    self.session['pass'] = user[0].pw
                    print 'here'
                    print user[0].imgURL
                    if user[0].imgURL:
                        self.session['imgURL'] = user[0].imgURL
                    else:
                        self.session['imgURL'] = '/images/profile.jpg'
                    
                    self.redirect('/profile')
                else:
                    template = 'index.html'
                    message = 'ERROR: Login Fail!'
                    self.redirect('/user?message='+message)
            elif method == 'logout':                                   # /userFunctions?method=logout
                self.session['user'] = None
                self.session['user_id'] = None
                # redirect in ajax call in header.html
                
#        params = {
#            'message': message,
#            'user_id': self.session.get('user_id')
#        }        
#        
#
#        app_global.render_template(self, template, params)
Exemplo n.º 11
0
 def get(self):
 	glassdoorScraper.getSalaries()
     app_global.render_template(self, 'base.html', {})
 def get(self):
     # images = imagesModels.getImages()
     app_global.render_template(self,'gallery.html',{'name':'dan', 'photo_name':'charlotte.jpg'})
Exemplo n.º 13
0
    def get(self):

        # images = imagesModels.getImages()
        
         

        #The following 10 lines of code just wipe the entire images, likes, comments datastore.
#        
#        users = userModel.Users.query()
#        for u in users.fetch():
#            u.key.delete()
#        
#        ims = imagesModel.Image.query()
#        for im in ims.fetch():
#            im.key.delete()
#
#        likes = imagesModel.Like.query()
#        for like in likes.fetch():
#                like.key.delete()
#                
#        coms = imagesModel.ImageComment.query()
#        for com in coms.fetch():
#                com.key.delete()
                
                
#        for i in range(1,17):
#            photo = {}
#            photo['name'] = 'girl'+ str(i) + '.jpg';
#            if i%2==0:
#                photo['adored'] = True;
#            else:
#                photo['adored'] = False;
#            photo_list.append(photo)

        #getImages(user_id, maxPrice, brandName, clothingType)
#       None is used to not consider that restriction

        user_id = app_global.unicode(self.session.get('user_id'))
    
        maxPrice = self.request.get('maxPrice')
        brandName = self.request.get('brand')
        clothingType = self.request.get('clothingType')
        
        if brandName == "":
            brandName = None
        if clothingType == "":
            clothingType = None
        if maxPrice == "":
            maxPrice = None
        
        #These things generate a price menu based on the prices. 
        #prices = [0, 25, 50] ==> priceOptions = ['$0-$25', '$25-$50', 'Over $50']
        priceOptions = list()
        lastValue = 0
        nextValue = prices[0]
        index = 0
        
        for i in range(0, len(prices)+1):
            if (i != len(prices)):
                priceOptions.append('$' + str(lastValue) + '-$' + str(nextValue))
            else:
                priceOptions.append('Over $' + str(nextValue))
            if (i < len(prices)-1):
                lastValue = nextValue
                index += 1
                nextValue = prices[index]
        
        
        #[25, 50]
        #['0-25', '25-50', 'Over 50'] 
        #This part just changes the option '25-50', etc. to an actual number for the filter.
        # '$0-$25' ==> minimumPrice = 0, maximumPrice = 25
        # Note: for maximum value. ie. over 1000, I use minimumPrice = highest + 1 (so 1001)
        # and maximumPrice = highest + 2 (so 1002).
        
        if maxPrice is not None:
            index = priceOptions.index(maxPrice)
            if index < len(priceOptions)-1:
                    maximumPrice = prices[index]
                    if (index-1 > -1):
                        minimumPrice = prices[index-1]
                    else:
                        minimumPrice = 0
            else:
                maximumPrice = prices[len(prices)-1] + 2
                minimumPrice = prices[len(prices)-1] + 1
        else:
            minimumPrice = None
            maximumPrice = None
       
        #This list is used to narrow the images down when filtering.
        restrictionList = list()
        restrictionList.append(minimumPrice)
        restrictionList.append(maximumPrice)
        restrictionList.append(brandName)
        restrictionList.append(clothingType)
        

        
        upload_url = blobstore.create_upload_url('/uploadImage')    

        
        user_id = app_global.unicode(self.session.get('user_id'))
        user = app_global.unicode(self.session.get('user'))
        imgURL = app_global.unicode(self.session.get('imgURL'))
        description = app_global.unicode(self.session.get('description'))
        gender = app_global.unicode(self.session.get('gender'))

        params = {
#            'photos': images,
            #'photos_json': json.dumps(images),
            'profilePicURL': imgURL,
            'user_id': user_id,
            'page': 'profile',
            'user': user,
            #'user_id': None, #testing when user is logged out
            'upload_url': upload_url,
            'brands': brands,
            'types': types,
            'prices': prices,
            'priceOptions': priceOptions,
            'description': description,
            'gender': gender,
            'deleteOption': user_id
        }

 
        app_global.render_template(self,'profile.html', params)
Exemplo n.º 14
0
    def get(self):
        # images = imagesModels.getImages()

        # The following 10 lines of code just wipe the entire images, likes, comments datastore.
        #
        #        users = userModel.Users.query()
        #        for u in users.fetch():
        #            u.key.delete()

        #        ims = imagesModel.Image.query()
        #        for im in ims.fetch():
        #            im.key.delete()
        #
        #        likes = imagesModel.Like.query()
        #        for like in likes.fetch():
        #                like.key.delete()
        #
        #        coms = imagesModel.ImageComment.query()
        #        for com in coms.fetch():
        #                com.key.delete()
        #

        #        for i in range(1,17):
        #            photo = {}
        #            photo['name'] = 'girl'+ str(i) + '.jpg';
        #            if i%2==0:
        #                photo['adored'] = True;
        #            else:
        #                photo['adored'] = False;
        #            photo_list.append(photo)

        # getImages(user_id, maxPrice, brandName, clothingType)
        #       None is used to not consider that restriction

        user_id = self.session.get("user_id")

        maxPrice = self.request.get("maxPrice")
        brandName = self.request.get("brand")
        clothingType = self.request.get("clothingType")

        if brandName == "":
            brandName = None
        if clothingType == "":
            clothingType = None
        if maxPrice == "":
            maxPrice = None

        # These things generate a price menu based on the prices.
        # prices = [0, 25, 50] ==> priceOptions = ['$0-$25', '$25-$50', 'Over $50']
        priceOptions = list()
        lastValue = 0
        nextValue = prices[0]
        index = 0

        for i in range(0, len(prices) + 1):
            if i != len(prices):
                priceOptions.append("$" + str(lastValue) + "-$" + str(nextValue))
            else:
                priceOptions.append("Over $" + str(nextValue))
            if i < len(prices) - 1:
                lastValue = nextValue
                index += 1
                nextValue = prices[index]

        # [25, 50]
        # ['0-25', '25-50', 'Over 50']
        # This part just changes the option '25-50', etc. to an actual number for the filter.
        # '$0-$25' ==> minimumPrice = 0, maximumPrice = 25
        # Note: for maximum value. ie. over 1000, I use minimumPrice = highest + 1 (so 1001)
        # and maximumPrice = highest + 2 (so 1002).

        if maxPrice is not None:
            index = priceOptions.index(maxPrice)
            if index < len(priceOptions) - 1:
                maximumPrice = prices[index]
                if index - 1 > -1:
                    minimumPrice = prices[index - 1]
                else:
                    minimumPrice = 0
            else:
                maximumPrice = prices[len(prices) - 1] + 2
                minimumPrice = prices[len(prices) - 1] + 1
        else:
            minimumPrice = None
            maximumPrice = None

        # This list is used to narrow the images down when filtering.
        restrictionList = list()
        restrictionList.append(minimumPrice)
        restrictionList.append(maximumPrice)
        restrictionList.append(brandName)
        restrictionList.append(clothingType)

        upload_url = blobstore.create_upload_url("/uploadImage")

        params = {
            #            'photos': images,
            #'photos_json': json.dumps(images),
            "user_id": app_global.unicode(self.session.get("user_id")),
            "user": app_global.unicode(self.session.get("user")),
            #'user_id': None, #testing when user is logged out
            "upload_url": upload_url,
            "brands": brands,
            "types": types,
            "prices": prices,
            "priceOptions": priceOptions,
            "page": "gallery",
        }

        app_global.render_template(self, "gallery2.html", params)
Exemplo n.º 15
0
 def get(self):
     # images = imagesModels.getImages()
     app_global.render_template(self,'index.html',{'page_name':'Thrifty Clothes', 'photo_name':'cow2.jpg'})
    def get(self):
        params = {

         }
        app_global.render_template(self,'about.html', params)
Exemplo n.º 17
0
 def get(self):
     # images = imagesModels.getImages()
     app_global.render_template(self,'testGallery.html', {})
 def get(self):
     # images = imagesModels.getImages()
     app_global.render_template(self,'profile.html', {'username':'******', 'profilePic':'profilePic.jpeg'})