Exemple #1
0
    def get(self):
        user = users.get_current_user()
        if user:
            signout_link_html = '<a href="%s">sign out</a>' % (
                users.create_logout_url('/'))
            email_address = user.nickname()
            cssi_user = CssiUser.query()

            search = self.request.get("search")
            clothes_query = Clothes.query().filter(
                Clothes.user == user.email())
            list_of_search = []

            make_template = jinja_current_dir.get_template(
                'templates/make-fits.html')  #html page to be used
            list_of_results = clothes_query.filter(
                Clothes.personal_organization == search).fetch()
            list_len = len(list_of_results)
            if list_len > 0:
                list_of_results[0].personal_organization
            for match in list_of_results:
                if match.key not in list_of_search:
                    list_of_search.append(match)

            dict = {'img': list_of_search}
            self.response.write(make_template.render(dict))
        else:
            # If the user isn't logged in...
            login_url = users.create_login_url('/welcome')
            # Prompt the user to sign in.
            self.redirect(login_url)
Exemple #2
0
    def get(self):
        user = users.get_current_user()
        # If the user is logged in...
        if user:
            upload_template = the_jinja_env.get_template(
                'templates/all-clothes.html')  #html page to be used

            clothes_query = Clothes.query().filter(
                Clothes.user == user.email())
            clothes_fetch = clothes_query.fetch()
            selected = "var_string"
            # count = "count"
            on_off = "on"

            the_variable_dict = {
                "user": user,
                'all_clothes': clothes_fetch,
                'selected': selected,
                "on-off": on_off
            }
            self.response.write(upload_template.render(the_variable_dict))
            # Clothes[selected].key.delete()
            signout_link_html = '<a href="%s">sign out</a>' % (
                users.create_logout_url('/welcome'))
            email_address = user.nickname()
            cssi_user = CssiUser.query().filter(
                CssiUser.email == email_address).get()

        else:
            # If the user isn't logged in...
            login_url = users.create_login_url('/welcome')
            self.redirect(login_url)  #SIgn in HTML
Exemple #3
0
 def get(self):
     user = users.get_current_user()
     # If the user is logged in...
     if user:
         signout_link_html = '<a href="%s">sign out</a>' % (
             users.create_logout_url('/'))
         email_address = user.nickname()
         cssi_user = CssiUser.query().filter(
             CssiUser.email == email_address).get()
         # If the user is registered...
         if cssi_user:
             # Greet them with their personal information
             self.response.write('''
         Welcome %s %s (%s)! <br> %s <br>''' %
                                 (cssi_user.first_name, cssi_user.last_name,
                                  email_address, signout_link_html))
         # If the user isn't registered...
         else:
             # Offer a registration form for a first-time visitor:                  #SIGN OUT PAGE
             self.response.write('''
     <head>
           <link rel="stylesheet" href="../stylesheets/style.css">
     <title>Sign out</title>
     </head>
     <header class="topnav">
       <img src="https://cdn1.iconfinder.com/data/icons/office-web/128/office-94-512.png">
       <nav>
         <ul>
           <li><a href="/welcome">Home</a></li>
           <li><a href="/all_clothes">Wardrobe</a></li>
           <li><a href="/upload">Upload</a></li>
           <li><a href="/make_outfits">Make Outfit</a></li>
           <li><a href="/about_us">About</a></li>
           <li><a href="/sign-in">Sign Out</a></li>
           <li>
           <form class="changepage" action="/search" method="get">
              <div class="input-field">
                  <input id="search" name="search" type="search" required>
                  <label class="label-icon" for="search">
                  <i class="material-icons">search</i></label>
               </div>
           </form>
           </ul>
         </nav>
         </header>
         <body style="background-color: powderblue">
         <br>
         <br>
         <br>
         <br>
         <h1 style="text-align: center;">Would you like to sign out? </h1>  <center> <a href=" %s "> <button id= "sign_out_button" type="button">Sign out!</button></a> <center> <br>  <br>
         ''' % (users.create_logout_url('/')))
     else:
         # If the user isn't logged in...
         login_url = users.create_login_url('/')
         self.redirect(login_url)  #SIgn in HTML
 def get(self):
     user = users.get_current_user()
     if user:
         signout_link_html = '<a href="%s">sign out</a>' % (
             users.create_logout_url('/sign-in'))
         email_address = user.nickname()
         cssi_user = CssiUser.query().filter(
             CssiUser.email == email_address).get()
         welcome_template = the_jinja_env.get_template(
             'templates/welcome.html')  #html page to be used
         self.response.write(welcome_template.render())
     else:
         # If the user isn't logged in...
         login_url = users.create_login_url('/welcome')
         self.redirect(login_url)  #SIgn in HTML
Exemple #5
0
    def get(self):
        user = users.get_current_user()
        # If the user is logged in...
        if user:
            made_template = the_jinja_env.get_template(
                'templates/made-fits-view.html')  #html page to be used

            outfit_query = Outfit.query().filter(Outfit.user == user.email())
            outfit_fetch = outfit_query.fetch()
            outfits = []
            for outfit in outfit_fetch:
                dict = {}
                if outfit.top:
                    dict['top'] = outfit.top.get()
                if outfit.bottoms:
                    dict['bottoms'] = outfit.bottoms.get()
                if outfit.shoes:
                    dict['shoes'] = outfit.shoes.get()
                if outfit.outerwear:
                    dict['outerwear'] = outfit.outerwear.get()
                outfits.append(dict)

            selected = "var_string"
            # count = "count"
            on_off = "on"
            the_variable_dict = {
                "user": user,
                'all_clothes': outfits,
                'selected': selected,
                "on-off": on_off
            }
            self.response.write(made_template.render(the_variable_dict))
            # Clothes[selected].key.delete()
            signout_link_html = '<a href="%s">sign out</a>' % (
                users.create_logout_url('/welcome'))
            email_address = user.nickname()
            cssi_user = CssiUser.query().filter(
                CssiUser.email == email_address).get()

        else:
            # If the user isn't logged in...
            login_url = users.create_login_url('/welcome')
            self.redirect(login_url)  #SIgn in HTML
    def get(self):
        user = users.get_current_user()
        # If the user is logged in...
        if user:
            signout_link_html = '<a href="%s">sign out</a>' % (
              users.create_logout_url('/sign-in'))
            email_address = user.nickname()
            cssi_user = CssiUser.query().filter(CssiUser.email == email_address).get()
            search_template = the_jinja_env.get_template('templates/search.html') #html page to be used

            self.response.write(search_template.render())
            aboutus_template = the_jinja_env.get_template('templates/aboutus.html') #html page to be used
            aboutus_template = the_jinja_env.get_template('templates/all-clothes.html') #html page to be used
            aboutus_template = the_jinja_env.get_template('templates/make-fits.html') #html page to be used
            aboutus_template = the_jinja_env.get_template('templates/search.html') #html page to be used
            aboutus_template = the_jinja_env.get_template('templates/upload.html') #html page to be used
            aboutus_template = the_jinja_env.get_template('templates/welcome.html') #html page to be used

            search = self.request.get("search")
            clothes_query = Clothes.query().filter(Clothes.user == user.email())
            list_of_search = []

            list_of_results = clothes_query.filter(Clothes.article_description == search).fetch()
            list_len = len(list_of_results)
            if list_len > 0:
                list_of_results[0].article_description
            for match in list_of_results:
                if match.key not in list_of_search:
                    list_of_search.append(match)


            list_of_results = clothes_query.filter(Clothes.article_name == search).fetch()
            list_len = len(list_of_results)
            if list_len > 0:
                list_of_results[0].article_name
            for match in list_of_results:
                if match.key not in list_of_search:
                    list_of_search.append(match)


            list_of_results =clothes_query.filter(Clothes.categories == search).fetch()
            list_len = len(list_of_results)
            if list_len > 0:
                list_of_results[0].categories
            for match in list_of_results:
                if match.key not in list_of_search:
                    list_of_search.append(match)

            list_of_results = clothes_query.filter(Clothes.img_url == search).fetch()
            list_len = len(list_of_results)
            if list_len > 0:
                list_of_results[0].img_url
            for match in list_of_results:
                if match.key not in list_of_search:
                    list_of_search.append(match)

            list_of_results = clothes_query.filter(Clothes.personal_organization == search).fetch()
            list_len = len(list_of_results)
            if list_len > 0:
                list_of_results[0].personal_organization
            for match in list_of_results:
                if match.key not in list_of_search:
                    list_of_search.append(match)

            dict = {
                'img': list_of_search
            }
            self.response.write(search_template.render(dict))
        else:
            # If the user isn't logged in...
            login_url = users.create_login_url('/welcome')
            self.redirect(login_url)          #SIgn in HTML