X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=guiltcards.py;h=00f02f8344bb0e0bfd4927d86ff1ed66132084c2;hb=75c92056e742fc2d3066c7e239e1b718ddf5fd26;hp=0487843cbdb53b4c6d304937da71e7da23ab8b5a;hpb=f77e6362f9b1e8d0e7bc93e4f6a0d6e1397e1b23;p=guiltcards diff --git a/guiltcards.py b/guiltcards.py index 0487843..00f02f8 100755 --- a/guiltcards.py +++ b/guiltcards.py @@ -84,10 +84,8 @@ def show_card(deck_id, card_id): data = get_card_data(deck_id, card_id, None) return dict(web_path=web_path, deck_id=deck_id, - card_type=data['type'], - title=data['title'], - paragraphs=data['paragraphs'], - answers=data['answers']) + card_id=card_id, + card=data) @post(web_path + '/decks//cards/') def update_card(deck_id, card_id): @@ -96,10 +94,7 @@ def update_card(deck_id, card_id): os.makedirs(cards_dir) path_card = cards_dir + '/' + card_id card_type = request.forms.get('type') - json_dict = {'type': request.forms.get('type'), - 'title': '', - 'answers': [], - 'paragraphs': []} + json_dict = {'type': request.forms.get('type')} if card_type == 'action': json_dict['title'] = request.forms.get('title') json_dict['paragraphs'] = request.forms.getall('paragraph') @@ -125,10 +120,7 @@ def card_form(deck_id, card_id): return dict(web_path=web_path, card_id=card_id, deck_id=deck_id, - card_type=data['type'], - title=data['title'], - paragraphs=data['paragraphs'], - answers=data['answers'], + card=data, deletable=deletable) @get(web_path + '/decks//cards//delete')