guild-journal/guild/views/__init__.py

18 lines
627 B
Python
Raw Normal View History

2023-06-10 19:33:06 +00:00
from django.views.generic import TemplateView, ListView, DetailView
from django.views.generic.edit import CreateView
2023-06-09 20:19:15 +00:00
from django.contrib.auth.mixins import LoginRequiredMixin
2023-06-09 19:51:18 +00:00
2023-06-11 18:37:03 +00:00
from guild.models import Adventure, Character, Player
2023-06-10 19:33:06 +00:00
2023-06-11 19:25:30 +00:00
2023-06-09 19:51:18 +00:00
# Create your views here.
2023-06-09 20:19:15 +00:00
class HomeView(LoginRequiredMixin, TemplateView):
template_name = "guild/home.html"
2023-06-10 19:33:06 +00:00
2023-06-11 18:01:36 +00:00
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["adventures"] = Adventure.objects.all()
2023-06-11 18:37:03 +00:00
context["players"] = Player.objects.all()
context["characters"] = Character.objects.all()
2023-06-11 18:01:36 +00:00
return context