Beispiel #1
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()
Beispiel #2
0
    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()
    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")