2023-08-25 19:50:09 +00:00
|
|
|
from django.views.generic import DetailView
|
2023-06-11 18:37:03 +00:00
|
|
|
from django.views.generic.edit import CreateView, UpdateView, DeleteView
|
2023-06-10 19:33:06 +00:00
|
|
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
|
|
|
|
|
|
|
from guild.models import Player
|
|
|
|
|
|
|
|
|
|
|
|
class CreatePlayerView(LoginRequiredMixin, CreateView):
|
|
|
|
model = Player
|
2023-06-19 18:23:15 +00:00
|
|
|
fields = ["name", "address"]
|
2023-06-10 19:33:06 +00:00
|
|
|
|
2023-06-11 19:25:30 +00:00
|
|
|
|
2023-06-10 19:33:06 +00:00
|
|
|
class PlayerDetailView(LoginRequiredMixin, DetailView):
|
2023-06-11 18:37:03 +00:00
|
|
|
model = Player
|
|
|
|
|
2023-06-11 19:25:30 +00:00
|
|
|
|
2023-06-11 18:37:03 +00:00
|
|
|
class PlayerUpdateView(LoginRequiredMixin, UpdateView):
|
|
|
|
model = Player
|
2023-06-19 18:23:15 +00:00
|
|
|
fields = ["name", "address"]
|
2023-06-11 18:37:03 +00:00
|
|
|
|
2023-06-11 19:25:30 +00:00
|
|
|
|
2023-06-11 18:37:03 +00:00
|
|
|
class PlayerDeleteView(LoginRequiredMixin, DeleteView):
|
|
|
|
model = Player
|
2023-06-11 19:25:30 +00:00
|
|
|
success_url = "/"
|