guild-journal/guild/views/player.py

25 lines
604 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 guild.models import Player
class CreatePlayerView(LoginRequiredMixin, CreateView):
model = Player
fields = ["name", "address"]
class PlayerDetailView(LoginRequiredMixin, DetailView):
model = Player
class PlayerUpdateView(LoginRequiredMixin, UpdateView):
model = Player
fields = ["name", "address"]
class PlayerDeleteView(LoginRequiredMixin, DeleteView):
model = Player
success_url = "/"