def get(self, request, *args, **kwargs): room = kwargs["room"] try: room = Room.objects.get(identifier=room) except Room.DoesNotExist: raise Http404 return render(request, template_name=self.template_name, context={ "title": room.name, "menu": menu.get(), "room": room, "is_moderator": request.user in room.moderators.all() or request.user.is_superuser, "x_range": list(range(25)), "y_range": list(range(17)), })
def get(self, request, *args, **kwargs): chants = sorted(ChantModel.objects.all(), key=lambda x: x.name) return render(request, template_name=self.template_name, context={ "title": "Chants", "menu": menu.get(), "chants": chants })
def get(self, request, *args, **kwargs): chant = ChantModel.objects.get(name=os.path.basename(request.path)) return render(request, template_name=self.template_name, context={ "title": chant.name, "menu": menu.get(), "chant": chant, "aspects": ", ".join(map(str, chant.aspects.all())), })
def get(self, request, *args, **kwargs): your_rooms = Room.objects.filter(moderators=request.user) others_rooms = Room.objects.exclude(moderators=request.user) return render(request, template_name=self.template_name, context={ "title": "Boards", "menu": menu.get("/board/"), "your_rooms": your_rooms, "others_rooms": others_rooms, })
def get(self, request, *args, **kwargs): campaigns = CampaignModel.objects.all() return render( request, self.template_name, { "title": "here be dragons", "menu": menu.get("/"), "campaign_list": [x for x in campaigns if x.is_part_of(request.user.username)], })
def get(self, request, *args, **kwargs): room = kwargs["room"] try: room = Room.objects.get(identifier=room) except Room.DoesNotExist: raise Http404 campaign = CampaignModel.objects.filter(room__in=[room.id])[0] if request.user.username not in [x.user.username for x in campaign.players.all()] and\ request.user.username not in [x.user.username for x in campaign.game_master.all()]: return HttpResponse("You're not allowed in this room") try: session = UserSession.objects.get(room=room, user=request.user) except UserSession.DoesNotExist: session = UserSession.objects.create(room=room, user=request.user, board_x=0, board_y=0, board_scale=1) return render( request, template_name=self.template_name, context={ "title": room.name, "menu": menu.get(), "room": room, "characters": room.character_set.all(), "session": session, "tiles": room.tile_set.all(), "is_moderator": request.user.id in [x.user.id for x in campaign.game_master.all()] or request.user.is_superuser, "x_range": list(range(25)), "y_range": list(range(17)), "jitsi_domain": settings.JITSI_DOMAIN if settings.JITSI_INTEGRATION else None, "jitsi_room": settings.JITSI_PREFIX + room.identifier if settings.JITSI_INTEGRATION else None, })
def get(self, request, *args, **kwargs): return render(request, self.template_name, { "title": "here be dragons", "menu": menu.get("/player/") })
class Login(LoginView): template_name = "auth/login.html" extra_context = {"title": "Login", "menu": menu.get("login")}