remove HTML from comment bodies

master
Laurent 6 years ago
parent 70ca6aeab6
commit 30529e98e4
  1. BIN
      db.sqlite3
  2. BIN
      news/__pycache__/views.cpython-37.pyc
  3. 3
      news/views.py

Binary file not shown.

@ -10,6 +10,7 @@ from django.contrib.auth import authenticate, login, logout, update_session_auth
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import PasswordChangeForm
from django.db.models import Q
from django.utils.html import strip_tags
from .models import Post, Comment, PostState
from .forms import PostForm, CustomUserCreationForm, SigninForm
from datetime import datetime
@ -141,7 +142,7 @@ def comment_with_parent(request, post_id, comment_id):
comment.post = get_object_or_404(Post, pk=post_id)
if comment_id is not None:
comment.parent_comment = get_object_or_404(Comment, pk=comment_id)
comment.body = request.POST['body']
comment.body = strip_tags(request.POST['body'])
comment.save()
comment.voters.add(request.user)
comment.save()

Loading…
Cancel
Save