2023-08-25 19:50:09 +00:00
|
|
|
from django.views.generic import ListView, DetailView
|
2023-08-25 19:42:46 +00:00
|
|
|
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 = "/"
|