Exemple #1
0
def add(request):
    theurl=request.POST['theurl']
    if theurl is not None:
        user=request.user
        album=Album.objects.get(name=u'$'+user.username)
        doc=Document()
        doc.author=user
        doc.album=album
        doc.price=0
        doc.title="淘宝商品"        
        doc.source=theurl
        ds=DocumentService()
        ds.syncDocument(doc)
        c=RequestContext(request,{'doc':doc})
        tt = loader.get_template('add.html')
        return HttpResponse(tt.render(c))
Exemple #2
0
def detail(request,doc_id):
    #TODO 检查是否当前用户
    doc=Document.objects.get(pk=doc_id)
    docSrv=DocumentService()
    doc=docSrv.syncDocument(doc)
    c=RequestContext(request,{'doc':doc})
    tt = loader.get_template('detail.html')
    return HttpResponse(tt.render(c))