guild-journal/guild/views/npc.py

29 lines
730 B
Python

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 guild.models import NPC
class NPCListView(LoginRequiredMixin, ListView):
model = NPC
context_object_name = "NPCs"
class CreateNPCView(LoginRequiredMixin, CreateView):
model = NPC
fields = ["name", "picture", "description"]
class NPCDetailView(LoginRequiredMixin, DetailView):
model = NPC
class NPCUpdateView(LoginRequiredMixin, UpdateView):
model = NPC
fields = ["name", "picture", "description"]
class NPCDeleteView(LoginRequiredMixin, DeleteView):
model = NPC
success_url = "/"