X-Git-Url: https://plomlompom.com/repos/?p=guiltcards;a=blobdiff_plain;f=guiltcards.py;fp=guiltcards.py;h=7d900df1e3fca444d26f334e0e7c4c7a9387e71b;hp=0487843cbdb53b4c6d304937da71e7da23ab8b5a;hb=f192f42b97251a378116ac5be16c8e5266dbc817;hpb=f77e6362f9b1e8d0e7bc93e4f6a0d6e1397e1b23 diff --git a/guiltcards.py b/guiltcards.py index 0487843..7d900df 100755 --- a/guiltcards.py +++ b/guiltcards.py @@ -84,10 +84,7 @@ 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=data) @post(web_path + '/decks//cards/') def update_card(deck_id, card_id): @@ -96,10 +93,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 +119,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')