Ejemplo n.º 1
0
def index(request):
    """  Define the index request.      
        当没有输入内容的时候,随即生成的字符串url保存到数据库里面
    """
    shstrfunc = generatestr
    bastr = generatestr()
    shstr = shstrfunc()
    #实现数据库里面保存把生成的字符串保存 
    Notepad.create_a_object(bastr, shstr)
    return redirect('/%s' %bastr)
Ejemplo n.º 2
0
def index(request):
    """  Define the index request.      
        当没有输入内容的时候,随即生成的字符串url保存到数据库里面
    """
    bastr = generateStr()
    shstr = generateStr()
    #实现数据库里面保存把生成的字符串保存 
    t1 = Notepad(basicStr = bastr, shareStr = shstr, text = "")
    t1.save()
    return redirect('/%s' % bastr) 
Ejemplo n.º 3
0
Archivo: views.py Proyecto: 52M/sphinx
def noteprocess(request, basic):
    """
        process function.    
    """
    if request.method == "POST":
        mytext = request.POST.get('myform', '')
    else:
        mytext = request.GET.get('myform', '')
    mynotepad = Notepad.get_object_by_basicstr(basic)
    mynotepad.text = mytext 
    mynotepad.save()
    
    all_obj = Notepad.get_all_objects() 
    return render(request, 'noteprocess.html', {'mynotepad':mynotepad, 'all_obj':all_obj})
Ejemplo n.º 4
0
def shareprocess(request, share):
    """
        share address
    """
    mytext = Notepad.get_object_by_sharestr(share)
    current_url = request.path
    return render(request, 'shareprocess.html', {'mytext':mytext, 'current_url':current_url})