'matching query does not exist. in django
Hi This is my Project I needed define two get_absolute_url in my project get_absolute_url one
models.py
def get_absolute_url(self):
return reverse("cv:resume_detial", args={self.id, self.slug})
urls.py
path('resume-detial/<int:resume_id>/<slug:resume_slug>', views.ResumeDetialView.as_view(), name="resume_detial"),
views.py
class ResumeDetialView(View):
template_name = 'cv/resume-detial.html'
def get(self, request, resume_id, resume_slug):
resumes = ResumeDetial.objects.get(pk=resume_id, slug=resume_slug)
return render(request, self.template_name, {'resumes':resumes})
This is a work But other get_absolute_url is does not work
models.py
def get_absolute_url(self):
return reverse("cv:project_detial", args={self.id, self.project_slug})
urls.py
path('project-detial/<int:project_id>/<slug:projects_slug>', views.ProjectDetialView.as_view(), name="project_detial"),
views.py
class ProjectDetialView(View):
template_name = 'cv/project-detial.html'
def get(self, request, project_id, projects_slug):
projects = ResumeDetial.objects.get(pk=project_id, slug=projects_slug)
return render(request, self.template_name, {"projects":projects})
django messages
DoesNotExist at /project-detial/1/todo-django
ResumeDetial matching query does not exist.
I am a beginner and thank you for your help
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
