Ejemplo n.º 1
0
def bucketlist_items(_id):
    """method used for displaying a bucketlists items"""
    page_title = "Items"
    bucketlist_ = Data.get_the_data(_id, Data.bucketlists)
    items = Data.get_the_data(_id, Data.items)
    notify = 'You have no items in this bucketlist yet'
    return render_template('items.html',
                           items=items,
                           notify=notify,
                           bucketlist_=bucketlist_,
                           title=page_title)
Ejemplo n.º 2
0
def delete_bucketlist(_id):
    """ deletes a bucketlist and its items"""
    Data.delete_dictionary(_id, Data.bucketlists)
    all_items = Data.get_the_data(_id, Data.items)
    if all_items is not None:
        for item in all_items:
            if item['_id'] in Data.items:
                Data.delete_dictionary(item['_id'], Data.items)
    flash('Bucketlist deleted', 'Danger')
    return redirect(url_for('dashboard'))
Ejemplo n.º 3
0
def dashboard():
    """method for displaying users bucketlists"""
    page_title = "Dashboard"
    bucketlists = Data.get_the_data(session['id'], Data.bucketlists)
    notify = 'You have no bucketlists yet'
    return render_template('dashboard.html',
                           bucketlists=bucketlists,
                           notify=notify,
                           username=session['username'],
                           title=page_title)
Ejemplo n.º 4
0
 def create_item(_id, item_name, description):
     """method used to create bucketlist items"""
     data_ = Data.get_the_data(_id, Data.bucketlists)
     for data in data_:
         bucketlist = Bucketlist(data['title'],
                                 data['owner'],
                                 data['intro'],
                                 data['owner_id'],
                                 data['_id'])
         bucketlist.new_item(item_name=item_name,
                             description=description)