guild-journal/guild/views/resource.py

29 lines
735 B
Python
Raw Permalink Normal View History

2023-08-25 19:50:09 +00:00
from django.views.generic import DetailView
2023-06-20 19:22:56 +00:00
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 = "/"