def canEditConditions(self, user, regionId): region = RegionManager.getRegionById(regionId) if region is not None and user is not None: if region == user or user.National: return True return False
def canListPlayersRegion(self, user, regionId): region = RegionManager.getRegionById(regionId) if region is not None and user is not None: if region == user or user.National: return True return False
def canCreateCompetition(self, user, regionId): region = RegionManager.getRegionById(regionId) if region is not None and user is not None: if region == user or user.National: return True return False
def listTeam(request): user = PermissionsManager.getPermissionsForUser(request.user) regionId = user.id region = RegionManager.getRegionById(regionId) headerDto = PermissionsManager.getUserHeaderDto(user).getDto() playersDto = PlayerManager.getPlayersForTeam(region, user) return render(request, 'playersListTeam.html', {'headerDto' : headerDto, 'playersDto': playersDto})
def listRegion(request,regionId): user = PermissionsManager.getPermissionsForUser(request.user) headerDto = PermissionsManager.getUserHeaderDto(user).getDto() regions = {} region = RegionManager.getRegionById(regionId) result = RegionManager.getAllRegions() for regionElement in result: regions[regionElement.RegionName] = RegionDto(regionElement) if PermissionsManager.canListPlayersRegion(user,regionId): playersDto = PlayerManager.getPlayersForRegion(region) return render(request, 'playersList.html', {'headerDto': headerDto, 'regions': regions, 'playersDto': playersDto}) else: return redirect('/')