What are you trying to do?
On Sat, 7 Sep 2019 20:30 Kean, <keanld1@gmail.com> wrote:
Hi,--New to Django, Have an issue. the table exists and the view references the table however, I still get 404 message.I have spent 8 hours trying to resolve, nothing seems to work, please help?urls.pypath('businesslogin/businessadmin/busproject',views.project_detail, name='project_detail'),models.pyclass Job(models.Model):name = models.CharField(max_length=100)budget = IntegerField()def __str__(self):return(self.name)class Category(models.Model):project = models.ForeignKey(Job, on_delete=models.CASCADE)name = models.CharField(max_length=150)def __str__(self):return(self.project)class Expense(models.Model):project = models.ForeignKey(Job, on_delete=models.CASCADE, related_name='expenses')title = models.CharField(max_length=100)amount = models.DecimalField(max_digits=8, decimal_places=2)category = models.ForeignKey(Category, on_delete=models.CASCADE)def __str__(self):return(self.project)views.pydef project_detail(request):project = get_object_or_404(Job)return render(request, 'projectdetail.html', {'project': project, 'expense_list': project.expenses.all()})Error message:Page not found (404)
Request Method: GET Request URL: http://127.0.0.1:8000/businesslogin/businessadmin/busproject Raised by: core.views.project_detail No Job matches the given query.
Please can anyone help, with getting the url to connect and resolving this error?
Best
Kean
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0c13a01b-ff4f-4c59-9f9c-d8805b1d2ef8%40googlegroups.com.
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPm7yyWW0kecfF3Rfu8tYnwfR5FtStj%3D9FWHLfjXQUCVth9WPg%40mail.gmail.com.
No comments:
Post a Comment