I want to control that only the superuser and for example the teacher, can access a page inherited from UpdateView and redirect others to the /404 page.
My class in views.py :
class Edit_news(UpdateView):
model = News
form_class = edit_NewsForm
template_name = "profile/Edit_news.html"
URL of class in urls.py :
from django.urls import path
from .views import Edit_news
urlpatterns = [
path("edit-news/<pk>", Edit_news.as_view()),
]