示例#1
0
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}
示例#2
0
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}
示例#3
0
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')
示例#4
0
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')