python - django - how to implement a 2-step publish mechanism -
i'm new both web development , django maybe that's noob question.
i want following:
- ask user fill form , submit it.
- then, parse , format content , display user let him verify it.
- user can accept result or go previous view, update data , resend.
this far can think:
views.py
def add_content(request): if request.method == 'post': form = addcontentform(request.post) if form.is_valid(): content = form.save(commit=false) return verify_content(request, content) else: form = addcontentform() return render(request, 'myapp/add_content.html', {'form' : form}) def verify_content(request, content): return render(request, 'myapp/verify_content.html', {'content' : content})
the verify_content template contain 2 buttons ('back', 'ok'), don't know how pass content object view saving in db, or send previous view there. should use js? can server side code?
maybe whole logic wrong. should save object in db before verification , delete if needed (sounds ugly)? way implement this?
thanks in advance time.
you use users session this:
request.session['content'] = content
and in view user should verify input do:
content = request.session['content']
and voilá got content between 2 views.
django secures users can't tinker data either saving server side, or in signed cookie.
Comments
Post a Comment