Changeset a3086eec3f31bdd96a8bc4498f6490a3d311b560


Ignore:
Timestamp:
27.04.2013 18:40:57 (6 years ago)
Author:
Tomasz Drag <tomek@…>
Branches:
b66903eafbcb1d49112014abc82c8bf683413db0
Children:
b6a0e40ed341ec9d1a72243e41dd9010874bd8fd
Parents:
57225b81a744d1ed8cdbcffec86eca10c8cf51fe
git-author:
Tomasz Drag <tomek@…> (27.04.2013 18:36:19)
git-committer:
Tomasz Drag <tomek@…> (27.04.2013 18:40:57)
Message:

Added saving and removing changes in database.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dashwiki/wiki/views.py

    r483808 ra3086e  
    119119def save_wiki(request, page_name): 
    120120  template = loader.get_template('display_wiki.html') 
    121  
    122121  page = load_wiki_or_null(page_name) 
     122  if page == None: 
     123    page = WikiPage(name=page_name) 
     124  page.content = request.POST['body'] 
     125  page.save() 
    123126  context = Context({ 
    124127    'name': page_name, 
    125128    'body': page.content if page else None, 
    126129    'editable': True, 
    127     'message': 'Wiki page saved' 
    128   }) 
    129  
     130    'message': 'Wiki page saved'         
     131  }) 
     132   
    130133  return HttpResponse(template.render(context)) 
    131134 
     
    188191def remove_wiki(request, page_name): 
    189192  template = loader.get_template('remove_wiki.html') 
    190  
    191193  page = load_wiki_or_null(page_name) 
     194  if 'confirm' in request.POST:  
     195    # FIXME: How about page = None? 
     196    page.delete() 
     197    page = None 
    192198  context = Context({ 
    193199    'name': page_name, 
Note: See TracChangeset for help on using the changeset viewer.