def save_object_description(request): """if object description does not exist, creates a new record, otherwise edits an existing one""" obj = get_db_object_or_404(request.POST) text = request.POST['text'] if obj.description: request.user.edit_post(obj.description, body_text=text) else: request.user.post_object_description(obj, body_text=text) return {'html': obj.description.html}
def load_object_description(request): """returns text of the object description in text""" obj = get_db_object_or_404(request.GET) # askbot forms utility text = getattr(obj.description, 'text', '').strip() return HttpResponse(text, content_type='text/plain')