Hi,
Try after name-spacing url patterns i.e
app_name = 'blog'
urlpatterns = [
path('', PostListView.as_view(), name='blog-home'),
path('user/<str:username>/', UserProfileListView.as_view(), name=
'user-profile' ),
path('user/<str:username>/posts/', UserPostListView.as_view(), name=
'user-posts'),
path('user/<str:username>/posts/view/', UserProfilePostListView.as_view
(), name='user-posts-view'),
path('post/<int:pk>/', PostDetailView.as_view(), name='post-detail'),
path('post/<int:pk>/comment/', views.add_comment, name='add-comment'),
path('post/new', PostCreateView.as_view(), name='post-create'),
path('post/<int:pk>/edit/', PostUpdateView.as_view(), name='post-update'
),
path('post/<int:pk>/delete/', PostDeleteView.as_view(), name=
'post-delete'),
path('about/', views.about, name='blog-about')
]
https://docs.djangoproject.com/en/2.1/topics/http/urls/#naming-url-patterns
On Fri, 12 Oct 2018 at 12:02, Manjunath <[email protected]> wrote:
> Try adding for action to your add_comment url then submit the form.
> I guess currently form is getting submitted in the same page.
>
> On Friday, October 12, 2018 at 12:00:03 PM UTC+5:30, Robert CR wrote:
>>
>> here is the template file.
>>
>> *add_comment.html*
>>
>>
>>
>> *{% extends "blog/base.html" %}{% load crispy_forms_tags %}{% block
>> content %} <div class="content-section"> <form method="POST"> {%
>> csrf_token %} <fieldset class="form-group"> <legend
>> class="border-bottom mb-4">Comment</legend> {{ form|crispy }}
>> </fieldset> <div class="form-group"> <button class="btn
>> btn-outline-warning" type="submit">Post Comment!</button> </div>
>> </form> </div>{% endblock content %}*
>>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> 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/aeaadfcb-38b7-4db2-9921-1c8c2485fd5e%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/aeaadfcb-38b7-4db2-9921-1c8c2485fd5e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
To post to this group, send email to [email protected].
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/CAHfehoVJDE5aGBgfHk1pJJ_ffZoMwuOx3vengZNdmjxfsNSktg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.