fork download
  1. def post_share(request, post_id):
  2. post = get_object_or_404(Post, id=post_id, status = 'published')
  3. sent = False
  4.  
  5. if request.method == 'POST':
  6. form = EmailPostForm(request.POST)
  7. if form.is_valid():
  8. cd = form.cleaned_data
  9. post_url = request.build_absolute_uri(post.get_absolute_url())
  10. subject = '{} ({}) recommends you reading "{}"'.format(cd['name'], cd['email'], post.title)
  11. message = 'Read "{}" at {}\n\n{}\'s comments: {}'.format(post.title, post_url, cd['name'], cd['comments'])
  12. send_mail(subject, message, 'admin@myblog.com',[cd['to']])
  13. sent = True
  14. else:
  15. form=EmailPostForm()
  16. return render(request, 'blog/post/share.html', {'post':post,
  17. 'form':form,
  18. 'sent':sent})
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Traceback (most recent call last):
  File "/usr/lib/python3.5/py_compile.py", line 125, in compile
    _optimize=optimize)
  File "<frozen importlib._bootstrap_external>", line 735, in source_to_code
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "./prog.py", line 10
    subject = '{} ({}) recommends you reading "{}"'.format(cd['name'], cd['email'], post.title)
                                                                                              ^
IndentationError: unindent does not match any outer indentation level

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.5/py_compile.py", line 129, in compile
    raise py_exc
py_compile.PyCompileError: Sorry: IndentationError: unindent does not match any outer indentation level (prog.py, line 10)
stdout
Standard output is empty