столкнулся с проблемой "NoReverseMatch at " в моем приложение и не пойму в чем причина.
urls.py
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from .views import ListProjects, ProjectDetail, RegisterUser, LoginUser, logout_user, like_view, AddComment, EditComment
urlpatterns = [
path('', ListProjects.as_view(), name='home'),
path('project/<slug:proj_slug>/', ProjectDetail.as_view(), name='project'),
path('login/', LoginUser.as_view(), name='login'),
path('logout/', logout_user, name='logout'),
path('register/', RegisterUser.as_view(), name='register'),
path('project/<slug:proj_slug>/like', like_view, name='like_project'),
path('project/<slug:proj_slug>/add_comment/', AddComment.as_view(), name='add_comment'),
path('project/<slug:proj_slug>/comment/<int:pk>/edit', EditComment.as_view(), name='edit_comment')
]
urlpatterns +=static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
views.py
class ProjectDetail(DetailView):
model = PortfolioStructure
template_name = 'WebPortfolioApp/details.html'
slug_url_kwarg = 'proj_slug'
context_object_name = 'project'
class AddComment(PermissionRequiredMixin, CreateView):
permission_required = ('comments.add_comment',)
model = Comment
form_class = CommentForm
template_name = 'WebPortfolioApp/add_comment.html'
def form_valid(self, form):
form.instance.project = PortfolioStructure.objects.get(slug=self.kwargs['proj_slug'])
return super().form_valid(form)
def get_success_url(self):
return reverse('project', kwargs={'proj_slug': self.object.project.slug})
class EditComment(PermissionRequiredMixin, UpdateView):
permission_required = ('comments.change_comment',)
model = Comment
form_class = CommentForm
template_name = 'WebPortfolioApp/add_comment.html'
def get_success_url(self):
return reverse('project', kwargs={'proj_slug': self.object.project.slug})
details.html:
<h2 class="mb-4">Comments...</h2>
{% if not project.comments.all %}
No Comments Yet...<div class="mb-4"><a class="link-primary" href="{% url 'add_comment' project.slug %}">Add comment</a></div>
{% else %}
<div class="mb-3"><a class="link-primary" href="{% url 'add_comment' project.slug %}">Add comment</a></div>
{% for comment in project.comments.all %}
<strong>
{{ comment.name }} -
{{ comment.date_added }}
</strong>
<br>
<p>{{ comment.body }}</p> <a href="{% url 'edit_comment' comment.pk %}">edit</a>
<br>
<br>
{% endfor %}
{% endif %}
Кто-нибудь знает в чем ошибка?