예제 #1
0
파일: managers.py 프로젝트: Leuzi/FAFAWeb
    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
예제 #2
0
파일: managers.py 프로젝트: Leuzi/FAFAWeb
    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
예제 #3
0
파일: managers.py 프로젝트: Leuzi/FAFAWeb
    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
예제 #4
0
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})
예제 #5
0
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('/')