problem with a form

7 views
Skip to first unread message

Thiago Brito

unread,
Jan 22, 2019, 2:16:09 PM1/22/19
to django...@googlegroups.com
Hi

I'm trying to save a post in my blog project. No problem. Its working.
But, when I try to show that post, I have this situation:

<h3 style="-webkit-tap-highlight-color: transparent; font-size: 25px; font-family: Montserrat; line-height: 40px; color: rgb(37, 58, 68); font-weight: 700; margin: 30px 0px; outline: none;">O que é Phyton?</h3><p style="-webkit-tap-highlight-color: transparent; outline: none; color: rgb(37, 58, 68); font-family: &quo....

in my view: 
def view_post(request, slug):
post = Post.objects.get(slug=slug)
return render(request, 'blog/view_post.html', {'post': post})


my html (the part of problem)
<p>{{ post.comments_text }}</p>

How can i got the correct format in my html?

Can anyone help me?

Tks

official...@gmail.com

unread,
Jan 22, 2019, 2:24:11 PM1/22/19
to Django users
in your html use
{{post}} instead of the .comment added

Shashank Singh

unread,
Jan 22, 2019, 11:32:11 PM1/22/19
to django...@googlegroups.com
post is a queryset and it doesn't have comment_text attribute.
{% for single_post in post %}
{{single_post.comment_text}}

On Tue, 22 Jan, 2019, 7:54 PM <official...@gmail.com wrote:
in your html use
{{post}} instead of the .comment added

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cad1a7bf-c20c-4a0a-89bc-7cb9d8be3d3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mamadou Harouna Diallo

unread,
Jan 22, 2019, 11:41:53 PM1/22/19
to django...@googlegroups.com
Your model post has a comment_text attribut ?
the slug passed are in the record table ?
Have you a error or your text is just not display ?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages