Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def manage(request):
- if (request.method == 'POST'):
- if ('format' in request.POST):
- format = request.POST['format']
- else:
- format = 'json'
- if ('submit' in request.POST) and (format == 'json'):
- if ('new_entry' in request.POST):
- # format: { "text" : "text body", "isPublic" : 0|1 }
- entry = json.loads(request.POST['new_entry'])
- entry_text = escape(entry.get('text'))
- entry_published = datetime.now()
- entry_isPublic = int(entry.get('isPublic'))
- new_entry = Entry(text=entry_text, published=entry_published, isPublic=entry_isPublic)
- new_entry.save()
Add Comment
Please, Sign In to add comment