コード例 #1
0
    def handle(self, *args, **options):

        # clear database
        Team.objects.all().delete()
        User.objects.all().delete()
        Player.objects.all().delete()

        with open('../../data/teams.csv') as csvfile:
            teams = csv.DictReader(csvfile)

            # import ipdb; ipdb.set_trace()

            for idx, (team_data, color) in enumerate(zip(teams,
                                                         color_palette)):
                if team_data["Team Name"] == "":
                    continue

                team = Team()
                team.name = team_data["Team Name"]
                team.university = team_data["University"]
                team.token = team_data["Token"]
                team.color = color
                team.flag = "flag%s" % idx
                team.score = 0
                team.save()

        teams = Team.objects.all()
        print("Loaded {} teams:".format(teams.count()))
        for team in teams:
            print(team)
コード例 #2
0
    def createsuperuser():
        team = Team()
        team.name = "CSGO_Admin"
        team.university = "UQUAM"
        team.token = "ADMINTOKEN"
        team.score = 0
        team.hidden = True
        team.save()

        univ_mail = "uqam.qc.ca"

        user = User()
        user.email = "player@" + univ_mail
        user.username = "******"
        user.first_name = "The"
        user.last_name = "Spear"
        user.is_staff = True
        user.is_superuser = True
        user.set_password("12qwaszx")
        user.save()

        player = Player()
        user.player = player
        player.last_name = "Spear"
        player.first_name = "The"
        player.display_name = "Klammydia"
        player.team = team

        player.save()
コード例 #3
0
ファイル: loadteams.py プロジェクト: CSGO-2016/Mission_Board
    def handle(self, *args, **options):

        # clear database
        Team.objects.all().delete()
        User.objects.all().delete()
        Player.objects.all().delete()

        with open('../../data/teams.csv') as csvfile:
            teams = csv.DictReader(csvfile)

            # import ipdb; ipdb.set_trace()

            for idx, (team_data, color) in enumerate(zip(teams, color_palette)):
                if team_data["Team Name"] == "":
                    continue

                team = Team()
                team.name = team_data["Team Name"]
                team.university = team_data["University"]
                team.token = team_data["Token"]
                team.color = color
                team.flag = "flag%s" % idx
                team.score = 0
                team.save()


        teams = Team.objects.all()
        print("Loaded {} teams:".format(teams.count()))
        for team in teams:
            print(team)
コード例 #4
0
ファイル: initdata.py プロジェクト: CSGO-2016/Mission_Board
    def createsuperuser():
        team = Team()
        team.name = "CSGO_Admin"
        team.university = "UQAM"
        team.token = "store170"
        team.score = 0
        team.hidden = True
        team.save()

        user = User()
        user.email = "*****@*****.**"
        user.username = "******"
        user.first_name = "Romain"
        user.last_name = "Chanoir"
        user.is_staff = True
        user.is_superuser = True
        user.set_password("givehimthecorporationyo")
        user.save()

        player = Player()
        user.player = player
        player.last_name = "Romain"
        player.first_name = "Chanoir"
        player.display_name = "Bl4ckMinou"
        player.team = team

        player.save()
コード例 #5
0
    def handle(self, *args, **options):

        # clear database
        Team.objects.all().delete()
        User.objects.all().delete()
        Player.objects.all().delete()

        with open('../../data/teams.json') as json_data:
            json_teams = json.load(json_data)

            for json_team in json_teams:
                team = Team()
                team.name = json_team["name"]
                team.university = json_team["university"]
                team.token = json_team["token"]
                team.color = json_team["color"]
                team.flag = json_team["flag"]
                team.score = json_team["score"]
                team.save()

                univ_mail = json_team["university"].replace(" ", "") + ".com"

                user = User()
                user.email = "player@" + univ_mail
                user.username = "******" + univ_mail[:-4].lower()
                user.first_name = "First-Name"
                user.last_name = "Last Name"
                user.set_password("12qwaszx")
                user.save()

                player = Player()
                user.player = player
                player.last_name = "Last Name"
                player.first_name = "First-Name"
                player.display_name = "Rebel_" + univ_mail
                player.team = team

                player.save()

        teams = Team.objects.all()
        print("Loaded {} teams:".format(teams.count()))
        for team in Team.objects.all():
            player = team.player_set.all().first()
            print("   * " + team.name, "Player login:"******"12qwaszx")