I’m trying to use a Class Based view with DetailView.
But I get the following error:
Reverse for ‘prijzenupdaten’ with no arguments not found. 1 pattern(s) tried: [‘dashboardadmin/prijzenupdaten/(?P[-a-zA-Z0-9_]+)$’]
These are some lines of my code:
URLS:
from django.urls import path
from . import views
urlpatterns = [
path('login', views.loginPageView.as_view(), name="loginpage"),
path('admin', views.admin, name="adminpage"),
path('dashboardadmin', views.dashboardadmin, name="dashboardadmin"),
path('dashboardadmin/klantaanmaken', views.klantaanmaken, name="klantaanmaken"),
path('dashboardadmin/algemeenoverzicht', views.algemeenOverzichtView.as_view(), name="algemeenoverzicht"),
path('dashboardadmin/prijzenupdaten/<slug:slug>', views.prijzenUpdatenView.as_view(), name="prijzenupdaten"),
path('dashboardadmin/leveringeninvoegen', views.leveringeninvoegen, name="leveringeninvoegen"),
path('dashboardadmin/ophalingeninvoegen', views.ophalingeninvoegen, name="ophalingeninvoegen"),
path('dashboardadmin/wegingeninvoegen', views.wegingeninvoegen, name="wegingeninvoegen"),
path('dashboardklant', views.dashboardklant, name="dashboardklant"),
]
VIEWS:
from django.views.generic.base import TemplateView
from webapp.forms import loginForm
from webapp.models import Account, Service, Prijzen
from django.contrib.auth.models import User
from django.shortcuts import get_object_or_404, redirect, render
from django.contrib.auth.forms import UserCreationForm
from django.contrib import messages
from django.contrib.auth.hashers import make_password
from django.views.generic.edit import CreateView, FormView
from django.views.generic.list import ListView
from django.views.generic import DetailView
from django.contrib.auth import authenticate, login, logout
# Create your views here.
from django.shortcuts import render
class prijzenUpdatenView(DetailView):
model = Prijzen
template_name = 'webapp/prijzenupdaten.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['service'] = Prijzen.objects.all()
return context
The database is also correctly filled:
What am I doing wrong?