コード例 #1
0
ファイル: main.py プロジェクト: WISVCH/szp4
    def run(self, args):
        team = Team()
        team.name = args.name
        team.organisation = args.organisation
        team.teamclass = Teamclass.objects.get(rank=args.teamclass)
        team.location = args.location
        team.save()
        Contest.objects.get().save()  # Updates 'resulttime'
        if args.ip or args.password:
            if args.password:
                user = User(username=team.name.replace(' ', '_'))
                user.set_password(args.password)
            else:
                user = User(username=args.ip.replace('.', '_'))
                user.set_unusable_password()
            user.save()

            profile = Profile()
            profile.is_judge = False
            profile.user = user
            profile.team = team
            if args.ip:
                profile.ip_address = socket.gethostbyname(args.ip)
            profile.save()
        else:
            print "Team '%s' has id %d" % (team.name, team.id)
コード例 #2
0
ファイル: main.py プロジェクト: WISVCH/szp4
 def run(self, args):
     user = User(username=args.username)
     if args.password:
         user.set_password(args.password)
     else:
         user.set_unusable_password()
     user.save()
     profile = Profile()
     profile.is_judge = True
     profile.user = user
     if args.team:
         profile.team = Team.objects.get(id=args.team)
     if args.ip:
         profile.ip_address = socket.gethostbyname(args.ip)
     profile.save()