Exemple #1
0
 def evNewItem(self):
     dlg = od.OptionsDialog(
         top, (["Name", ""], ["Description", ""], ["Owner", ""],
               ["Price", ""], ["Condition", ""]))
     if dlg.changed:
         ownerID = self.get_member_id(dlg.options[2][1])
         data.insert_item(dlg.options[0][1], dlg.options[1][1], ownerID,
                          int(dlg.options[3][1]), dlg.options[4][1])
         self.items = data.get_items()
         self.populateItemList()
Exemple #2
0
    def ev_new_item(self):
        dlg = od.OptionsDialog(top, (
            ["Name", ""],
            ["Description", ""],
            ["Owner", ""],
            ["Price", ""],
            ["Condition", ""]
        ))

        if dlg.changed:
            owner_id = self.get_member_id(dlg.options[2][1])
            data.insert_item(dlg.options[0][1], dlg.options[1][1], owner_id, int(dlg.options[3][1]), dlg.options[4][1])
        self.items = data.get_items()
        self.populate_item_list()
def add_item():
    if not session.get("logged_in"):
        abort(401)
    get_db()
    owner_id = [row[0] for row in lendydata.get_members() if row[1] == request.form["owner"]]
    try:
        owner_id = owner_id[0]
    except IndexError:
        # implies no owners match name
        # should raise error/create new member
        owner_id = 1  # use default member for now

    lendydata.insert_item(request.form["name"], request.form["description"], owner_id, request.form["price"],
                          request.form["condition"])
    flash("New entry was successfully posted")
    return redirect(url_for("show_inventory"))
Exemple #4
0
def add_item():
    if not session.get("logged_in"):
        abort(401)
    get_db()
    owner_id = [
        row[0] for row in lendydata.get_members()
        if row[1] == request.form["owner"]
    ]
    try:
        owner_id = owner_id[0]
    except IndexError:
        # implies no owners match name
        # should raise error/create new member
        owner_id = 1  # use default member for now

    lendydata.insert_item(request.form["name"], request.form["description"],
                          owner_id, request.form["price"],
                          request.form["condition"])
    flash("New entry was successfully posted")
    return redirect(url_for("show_inventory"))
Exemple #5
0
def add_item():
    if not session.get('logged_in'):
        abort(401)
    get_db()
    ownerID = [
        row[0] for row in lendydata.get_members()
        if row[1] == request.form['owner']
    ]
    try:
        ownerID = ownerID[0]
    except IndexError:
        # implies no owners match name
        # should raise error/create new member
        ownerID = 1  # use default member for now.

    lendydata.insert_item(request.form['name'], request.form['description'],
                          ownerID, request.form['price'],
                          request.form['condition'])

    flash('New entry was successfully posted')
    return redirect(url_for('show_inventory'))
Exemple #6
0
def add_item():
    if not session.get('logged_in'):
        abort(401)

    lendydata.initDB()
    ownerID = [row[0] for row in lendydata.get_members() 
               if row[1] == request.form['owner']]
    try: ownerID = ownerID[0]  
    except IndexError:
        # implies no owners match name
        # should raise eror/create new member
        ownerID = 1      # use default member for now.

    lendydata.insert_item(request.form['name'], 
                          request.form['description'],
                          ownerID,
                          request.form['price'],
                          request.form['condition'])
                         
    lendydata.closeDB()

    flash('New entry was successfully posted')
    return redirect(url_for('show_inventory'))
Exemple #7
0
__author__ = 'Stuart'

"""
any time there is a print, if in console don't print
it would just return normally
"""

import lendydata as ld
ld.initDB()
print(ld.get_members())
print(ld.get_items())

ld.insert_item('Python Projects','Book',6,30,'Excellent')
###
# this should not have worked..... BUT IT DID. WTF PRAGMA?!>!?
###

ld.insert_member('Alan','*****@*****.**')
print(ld.get_members())
ld.insert_item('Python Projects','Book',6,30,'Excellent')
ld.get_items()

ld.update_item(7,Price=25)
ld.get_item_details(7)
ld.get_member_name(6)
ld.update_member(6,Name='Alan Gould')
ld.get_member_details(6)

ld.delete_member(6)  # this also shouldn't work due to referential integrity, but does...
ld.delete_item(7)
ld.delete_member(6)