29 lines
735 B
Python
29 lines
735 B
Python
from django.views.generic import 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 = "/"
|