def delete(self, id, name, displayName, bio, age, hobbies, contact, sex):
     alpaca = Alpaca(id, name, displayName, bio, age, hobbies, contact, sex)
     alpaca.delete(id, name, displayName, bio, age, hobbies, contact, sex)
     data = {'message': name + 'was succesfully deleted'}
     print('Deleting Alpaca', id, name, displayName, bio, age, hobbies,
           contact, sex)
     return jsonify(data)
    def index(self, sel):
        if sel == "ALL":
            alpacas = Alpaca.get_all(None)
        elif sel == "below":
            alpacas = Alpaca.get_below(25)
        else:
            alpacas = Alpaca.get_above(25)
            
        data = []
        for alpaca in alpacas:
            data.append({'name': alpaca.name,'displayName': alpaca.display_name,'age': alpaca.age, 'sex': alpaca.sex, 'filename': alpaca.get_filename()})

        return render_template("index.html", alpacas=data, sel=sel)
Beispiel #3
0
 def profile(self, name):
     data = Alpaca().get(name)
     results = {
         'name': data.name,
         'displayName': data.displayName,
         'profilePic': Alpaca().get_filename(data.name),
         'hobbies': data.hobbiesList,
         'bio': data.bio,
         'hobbies': data.hobbiesList,
         'contact': data.contactList
     }
     return render_template("profile.html",
                            results=results,
                            hobbies=results['hobbies'],
                            contact=json.dumps(results['contact']))
    def create(self, name, sex, bio, dName, age, hobbiesList, contactList):
        alpaca = Alpaca(name, sex, bio, dName, age, hobbiesList, contactList)
        data = {'message': "successfully created the following user: " + name}
        print('saving alpaca', name, sex, bio, dName, age, hobbiesList,
              contactList)

        return jsonify(data)
Beispiel #5
0
    def profile(self, name):
        alpaca = Alpaca.get(name)

        return render_template("profile.html",
                               displayName=alpaca.display_name,
                               filename=alpaca.get_filename(),
                               age=alpaca.age,
                               hobbies=alpaca.hobbies,
                               contact=json.dumps(alpaca.contact))
Beispiel #6
0
    def index(self, age):
        data = Alpaca().get_all(age)
        results = []
        for item in data:
            alpaca = {
                'name': item.name,
                'displayName': item.displayName,
                'profilePic': Alpaca().get_filename(item.name),
                'age': item.age,
                'sex': item.sex
            }
            results.append(alpaca)
        if age != None:
            intage = int(age)
        else:
            intage = age

        return render_template("index.html", results=results, age=intage)
Beispiel #7
0
    def delete(self, name):
        deletedAlpaca = Alpaca().get(name)
        data = {
            'message':
            "successfully delete the following user: " + deletedAlpaca.name
        }
        print('deleting alpaca', deletedAlpaca.name)

        return jsonify(data)
Beispiel #8
0
 def index(self, age):
     alpacas = Alpaca.get_all(age)
     data = []
     for alpaca in alpacas:
         data.append({
             'name': alpaca.name,
             'displayName': alpaca.display_name,
             'age': alpaca.age,
             'sex': alpaca.sex,
             'bio': alpaca.bio,
             'filename': alpaca.get_filename()
         })
     return render_template("index.html", alpacas=data, age=age)
Beispiel #9
0
    def search(self, name):
        if name == None:
            results = {
                'message': "you gave no parameters. could find no users"
            }
        else:
            data = Alpaca().get_all()
            results = {'message': []}
            for item in data:
                if name in item.name:
                    results['message'].append(
                        "searching with the letter " + name +
                        " we found the following user: "******"\n")
                    print("using " + name + " we found the following user: " +
                          item.name)

        return jsonify(results)
 def create(self, id, name, displayName, bio, age, hobbies, contact, sex):
     alpaca = Alpaca(id, name, displayName, bio, age, hobbies, contact, sex)
     data = {'message': name + "was succesfully created"}
     print('Creating Alpaca', id, name, displayName, bio, age, hobbies,
           contact, sex)
     return jsonify(data)
 def create(self, id, name, display_name, bio, age, hobbies, contact, sex):
     alpaca = Alpaca(id, name, display_name, bio, age, hobbies, contact, sex)
     return {'message': '%s was created' % (name),'success': True}
 def search(self):
     alpaca = Alpaca.get(name)
     return render_template("profile.html/<name>", displayName=alpaca.display_name, filename=alpaca.get_filename(), age=alpaca.age, bio=alpaca.bio, hobbies=alpaca.hobbies,
 contact=json.dumps(alpaca.contact))