Пример #1
0
    def get(self):
        """(for developing mode) Adds initial data to database"""
        user = users.get_current_user()
        com1 = Command(name=u'Фортуна', territory=u'Ангарск')
        com2 = Command(name=u'Фортуна', territory=u'Москва')
        com1.put()
        com2.put()
        paswd = '123'
        paswd = salt_pass(paswd)
        org1 = Organizer(user=users.User('*****@*****.**'), nickname=u'Олишевская Анна', contact='*****@*****.**')
        org2 = Organizer(user=users.User('*****@*****.**'), nickname=u'Тест Тестович', contact='*****@*****.**')
        org3 = Organizer(user=users.User('*****@*****.**'), nickname=u'Плотникова Дарья', contact='*****@*****.**')
        org4 = Organizer(user=users.User('*****@*****.**'), nickname=u'Потапейко Дмитрий', contact='*****@*****.**')
        lead1 = Leader(user=users.User('*****@*****.**'), nickname=u'Олишевская Анна', contact='*****@*****.**', command=com2)

        memb1 = Member(pass_to_edit=paswd, sex=u'Женский', nickname='*****@*****.**', surname=u'Плотникова Дарья',
                       command=com1, birthdate=1994, qualification='I')
        memb2 = Member(pass_to_edit=paswd, sex=u'Мужской', nickname='[email protected]', surname=u'Хайруллин Марат', command=com1,
                       birthdate=1994, qualification='I')
        memb3 = Member(pass_to_edit=paswd, sex=u'Мужской', nickname='*****@*****.**', surname=u'Потапейко Дмитрий',
                       command=com2, birthdate=1995, qualification='I')
        memb1.put()
        memb2.put()
        memb3.put()
        org1.put()
        org2.put()
        org3.put()
        org4.put()
        lead1.put()
Пример #2
0
 def post(self):
     """Deletes certain user from current competition"""
     memb_key = self.request.POST.get("member")
     member = Member.get(memb_key)
     paswd = self.request.POST.get("changePass")
     comp_key = self.request.POST.get("competition")
     comp = Competition.get(comp_key)
     if salt_pass(paswd) == member.pass_to_edit:
         comp_membs = CompMemb.all().filter("member =", member).filter("competition =", comp)
         db.delete(comp_membs)
         time.sleep(0.1)
         self.redirect("/entryOneMemb?competition=" + comp_key)
     else:
         self.redirect("/deleteFromComp?competition=" + comp_key + "&member=" + memb_key + "&tooltip=True")
Пример #3
0
 def post(self):
     """Saves current member's changes"""
     comp_key = self.request.POST.get("competition")
     passwd = self.request.POST.get("changePass")
     memb_key = self.request.POST.get("member")
     member = Member.get(memb_key)
     if salt_pass(passwd) == member.pass_to_edit:
         surname = self.request.POST.get("surnameMemb") + " " + self.request.POST.get("nameMemb")
         age = int(self.request.POST.get("ageMemb"))
         qual = self.request.POST.get("qualMemb")
         member.surname = surname
         member.birthdate = age
         member.qualification = qual
         member.put()
         time.sleep(0.1)
         self.redirect("/entryOneMemb?competition=%s" % comp_key)
     else:
         self.redirect("/memberInfo?competition=%s" % comp_key + "&member=%s" % memb_key + "&tooltip=True")
Пример #4
0
 def post(self):
     """Saves current member to database so that he will take a part in competition"""
     memb_key = self.request.POST.get("member")
     memb = Member.get(memb_key)
     paswd = self.request.POST.get("changePass")
     comp_key = self.request.POST.get("competition")
     comp = Competition.get(comp_key)
     if salt_pass(paswd) == memb.pass_to_edit:
         for i in range(comp.days_count):
             infos_count = int(self.request.POST.get("infosCount%s" % str(i)))
             for group_num in range(infos_count):
                 checked_group = self.request.POST.get("checkMembGroup%s" % (str(i) + str(group_num)))
                 if checked_group:
                     entry = CompMemb(competition=comp, member=memb, group=checked_group, day_numb=i + 1)
                     entry.put()
                     time.sleep(0.1)
                     self.redirect("/entryOneMemb?competition=" + comp_key)
     else:
         login = users.create_login_url(dest_url="/postSignIn")
         distances = db.Query(Distance).filter("competition =", comp).order("day_numb")
         groups_by_days = []
         for dist in distances:
             groups_by_days.append(dist.distinfo_set.run(batch_size=100))
         temp_values = {
             "login": login,
             "logout": users.create_logout_url("/login"),
             "name": comp.name,
             "surname": memb.surname,
             "team": memb.command.name,
             "memb_key": memb_key,
             "competition": comp_key,
             "card_title": u"Заявка участника",
             "dists": distances,
             "groups_by_day": groups_by_days,
             "tooltip": u"Неверный пароль подтверждения. Попробуйте еще раз",
         }
         template = JINJA_ENVIRONMENT.get_template("/templates/tmmosc/member/ToDaysGroups.html")
         self.response.write(template.render(temp_values))