guild-journal/guild/views/resource.py

29 lines
759 B
Python
Raw Normal View History

2023-06-20 19:22:56 +00:00
from django.views.generic import TemplateView, ListView, DetailView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse
from guild.models import Resource
class CreateResourceView(LoginRequiredMixin, CreateView):
model = Resource
fields = ["name", "description"]
def get_success_url(self):
return reverse("guild:settings")
class ResourceDetailView(LoginRequiredMixin, DetailView):
model = Resource
class ResourceUpdateView(LoginRequiredMixin, UpdateView):
model = Resource
fields = ["name", "description"]
class ResourceDeleteView(LoginRequiredMixin, DeleteView):
model = Resource
success_url = "/"