当前位置: 首页>>代码示例>>Python>>正文


Python models.Member类代码示例

本文整理汇总了Python中models.Member的典型用法代码示例。如果您正苦于以下问题:Python Member类的具体用法?Python Member怎么用?Python Member使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Member类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get

 def get(self):
     db = getUtility(IRelationalDatabase)
     cr = db.cursor()
     number = self.member.number
     if number:
         cr.execute("""SELECT
                         id,
                         number,
                         name
                       FROM members
                       WHERE number = ?""",
                    (number,))
     else:
         cr.execute("""SELECT
                         id,
                         number,
                         name
                       FROM members""")
     rst = cr.fetchall()
     cr.close()
     members = []
     for record in rst:
         id = record['id']
         number = record['number']
         name = record['name']
         member = Member()
         member.id = id
         member.number = number
         member.name = name
         members.append(member)
     return members
开发者ID:eugeneai,项目名称:ZCA,代码行数:31,代码来源:member.py

示例2: get

	def get(self, args):
		if not require_admin(self):
			return
		
		template_vals = generate_base_template_vals(self)
		template_vals['title'] = 'Edit Member'
		template_vals['page'] = 'members'
		
		req_id = self.request.get('id')
		
		if not req_id:
			while True:
				# Create a new ID and verify it is unique.
				new_id = uuid4().hex
				if not Member.query(Member.id == new_id).get():
					new_member = Member()
					new_member.id = new_id
					new_member.name = 'New Member'
					template_vals['member'] = new_member
					break
		else:
			member = Member.query(Member.id == req_id).get()
			if member:
				template_vals['member'] = member
			else:
				self.error(404)
				return
		
		template_vals['semesters'] = get_all_semesters()
		
		template = JINJA_ENVIRONMENT.get_template('member_edit.html')
		self.response.write(template.render(template_vals))
开发者ID:zmyaro,项目名称:star-site,代码行数:32,代码来源:members.py

示例3: json_add_member

def json_add_member(request, band_id):
    if isInBand(request.user, band_id):
        #current user is in this band
        if isManager(request.user, band_id):
            #current user is a manager
            if request.method == 'POST':
                #load data
                data = json.loads(request.body)
                #add an invitation to the email provided
                band = Band.objects.get(id=band_id)
                if "email" in data:
                    email = data["email"]
                else:
                    email = None
                newInv = Invitation(band=band, email=email, active=True)
                newInv.save()
                #add the member to the band regardless
                name = data["name"]
                role = data["role"]
                if "phone" in data:
                    phone = data["phone"]
                else:
                    phone = None
                status = data["status"]
                newMem = Member(band=band, name=name, role=role, phone=phone, status=status, email=email)
                newMem.save()
                return HttpResponse("success")
    return HttpResponse("failure")
开发者ID:nmyers322,项目名称:BandManager,代码行数:28,代码来源:views.py

示例4: get

 def get(self, key):
     edit = self.request.get('edit')
     template_dict = {'key': key, 'show_form' : True,'members': Member.all(),
                      'edit':edit,'thing' : self.thing_descriptors.get(edit),'images':Image.all().filter('name != ', "no-name") }
     if key == 'new':
         template_dict['form_data'] = {
             'author': Member.get_current_member().handle,
             'date': unicode(datetime.date.today())}
     else:
         try:
             if(edit=='news'):
                thing = NewsArticleNew.get(Key(key))
                form_data={'title':thing.title,'author':thing.author,'date':unicode(thing.date),'body':thing.body,'picture':thing.picture}
             elif(edit=='talk'):
                thing = TalkNew.get(Key(key))
                form_data={'title':thing.title,'author':thing.author,'date':unicode(thing.date),'body':thing.body,'video':thing.video}
             elif(edit=='hack'):
                thing = Hack.get(Key(key))
                form_data={'title':thing.title,'date':unicode(thing.date),'body':thing.body,'picture':thing.picture}
             template_dict['form_data']=form_data
         except BadKeyError:
             template_dict['message'] = \
                 'Could not find %s with key %r.' %  (self.thing_descriptors.get(edit), key)
             template_dict['show_form'] = False
     self.render_template('edit', template_dict)
开发者ID:Man-UP,项目名称:website,代码行数:25,代码来源:handlers.py

示例5: add_user

def add_user():
    # dummy user and dummy member are created on first request.
    # user is responsible for creating dummy events.
    Event.create_table(fail_silently=True)
    Member.create_table(fail_silently=True)
    Minute.create_table(fail_silently=True)
    Picture.create_table(fail_silently=True)
    User.create_table(fail_silently=True)
#
#     # create a dummy member
#     try:
#         member = Member(first_name="Bryan",
#                         last_name="Bennett",
#                         collegiate_chapter="Zeta Omicron "
#                                            "(Georgia Southern University)",
#                         initiation_date=datetime.date(2006, 04, 06),
#                         office="Secretary, Warden",
#                         image_path="Bryan_Bennett.jpg")
#         member.save()
#     except IntegrityError as e:
#         print e
#
    # create a dummy user
    try:
        admin = User(username='bbenne10', email='[email protected]',
                     admin=True, active=True)
        admin.set_password("password")
        admin.save()
    except IntegrityError as e:
        print e
开发者ID:bbenne10,项目名称:atlsinfonia,代码行数:30,代码来源:routes.py

示例6: post

    def post(self):
        if len(self.request.POST) == 4 and 'handle' in self.request.POST \
                and 'real_name' in self.request.POST \
                and 'email' in self.request.POST \
                and 'bio' in self.request.POST:

            handle = self.request.POST.getall('handle')[0]
            template_dict = {}
            member = Member.get_current_member()
            other = Member.gql('WHERE handle = :1', handle).get()

            if (not handle or len(handle) > 12 or
                any(l not in self.valid_letters for l in handle)):
                template_dict['error'] = 'Pick something sensible, you moron.'

            elif other and other.user_id != member.user_id:
                template_dict['error'] = 'Sorry, already taken.'

            elif handle.lower() in self.banned_names:
                template_dict['error'] = self.banned_names[handle]

            else:
                real_name = self.request.POST.getall('real_name')[0]
                if real_name:
                    member.real_name = real_name
                email = self.request.POST.getall('email')[0]
                if email:
                    member.email = email
                bio = self.request.POST.getall('bio')[0]
                if bio:
                    member.bio = bio
                member.handle = handle
                member.save()
                template_dict['error'] = 'Profile updated'
            self.render_template('account', template_dict)
开发者ID:Man-UP,项目名称:website,代码行数:35,代码来源:handlers.py

示例7: get

 def get(self, member_id=""):
     if member_id:
         self.member_allowd(member_id)
         members = Member.get_by_id(member_id)
     else:
         members = Member.get_by_uid(self.current_user)
     result = {"data": members}
     self.finish(result)
开发者ID:cnspica,项目名称:Joyaay,代码行数:8,代码来源:member.py

示例8: on_add_clicked

 def on_add_clicked(self, *args):
     number = self.ui.number.get_text()
     name = self.ui.name.get_text()
     member = Member()
     member.number = number
     member.name = name
     self.add(member)
     self.ui.list_store.append((member, number, name,))
开发者ID:eugeneai,项目名称:ZCA,代码行数:8,代码来源:vc.py

示例9: create_callback

def create_callback(sender, *args, **kwargs):
  user = kwargs['user']
  member = Member()
  member.user = user
  member.save()
  #now we want to create a goal for this member,
  #so they have something and get goals
  goal = Goal(goal_name="Create more goals!",num_per_frame=1,time_frame_len='d')
  goal.member = member
  goal.save()
开发者ID:jackschultz,项目名称:streakflow,代码行数:10,代码来源:signals.py

示例10: create

 def create(self):
     """Creates and returns a new member"""
     member = MemberModel()
     name = input("Name: ")
     personal_number = self._read_personal_number("Pesonal Number:")
     member.name = name
     member.personal_number = personal_number
     self.display(member)
     if not self._read_binary("Is this correct?"):
         self.edit(member)
     return member
开发者ID:rk222ev,项目名称:1dv607_Member_registry,代码行数:11,代码来源:member.py

示例11: member

def member(request):
    response = {}

    if request.method == "POST":
        user = request.data["userId"]
        password = request.data["password"]

        if user is None or password is None:
            response["STS"] = ERR_USER_PARAM
            response["MSG"] = MSG[ERR_USER_PARAM]

            return Response(response)

        member = Member(user=user, password=password)
        member.save()

        response["STS"] = SUCCESS
        response["MSG"] = MSG[SUCCESS]
        response["DAT"] = member.id

        return Response(response)

    if request.method == "GET":
        user = request.query_params["userId"]
        password = request.query_params["password"]

        if user is None or password is None:
            response["STS"] = ERR_USER_PARAM
            response["MSG"] = MSG[ERR_USER_PARAM]

            return Response(response)

        member = Member.objects.filter(user=user, password=password)

        if not member:
            response["STS"] = ERR_DB_SELECT
            response["MSG"] = "Login Fail. Check user id and password"
        else:
            resData = {}
            resData["id"] = member[0].id
            resData["user"] = member[0].user

            request.session["login"] = True
            request.session["member_id"] = member[0].id
            request.session["member_user"] = member[0].user

            response["STS"] = SUCCESS
            response["MSG"] = MSG[SUCCESS]
            response["DAT"] = resData

            return Response(response)
开发者ID:ElvinKim,项目名称:django-angular-board-project,代码行数:51,代码来源:api.py

示例12: get_current_user

 def get_current_user(self):
     mid = self.session.get("mid")
     logined = self.session.get("logined")
     if mid and logined:
         member = Member.getObjectByObjectId(mid)
         return member
     else:
         member_cookie = self.get_secure_cookie(self.settings["cookie_name"])
         if member_cookie:
             member_json = self.parseJson(member_cookie)
             if member_json.get("mid") and member_json.get("logined"):
                 member = Member.getObjectByObjectId(mid)
                 return member
     return None
开发者ID:ergatea,项目名称:gitpub2,代码行数:14,代码来源:base.py

示例13: testLimitOffset

    def testLimitOffset(self):
        team = Team.create(name="Houkago Tea Time")
        for name in self.names:
            team.members.append(first_name=name[0], last_name=name[1], part=name[2], age=name[3])

        # OFFSET 2
        qs = Member.all().offset(2).order_by("id")
        self.assertEqual(qs[0].first_name, "Yui")
        self.assertEqual(qs[1].first_name, "Tsumugi")
        self.assertEqual(qs.count(), 3)

        # LIMIT 1 OFFSET 2
        qs = Member.all().offset(2).limit(1).order_by("id")
        self.assertEqual(qs[0].first_name, "Yui")
        self.assertEqual(qs.count(), 1)
开发者ID:FrViPofm,项目名称:macaron,代码行数:15,代码来源:test_query.py

示例14: create_mention

def create_mention(**kwargs):
    receiver = Member.getMemberByUsername(kwargs['username'])
    if receiver:
        kwargs.update(receiver=receiver)
        reminder = Reminder.create(**kwargs)
    else:
        logging.error("no member found")
开发者ID:ergatea,项目名称:gitpub2,代码行数:7,代码来源:reminder.py

示例15: book_issue

    def book_issue(self, member_number, book_barcode):
        member = Member()
        member.number = member_number
        memberdboperation = getAdapter(member, IDbOperation)
        member = memberdboperation.get()[0]

        book = Book()
        book.number = book_barcode
        bookdboperation = getAdapter(book, IDbOperation)
        book = bookdboperation.get()[0]

        circulation = Circulation()
        circulation.member = member
        circulation.book = book
        circulationdboperation = getAdapter(circulation, IDbOperation)
        circulationdboperation.add()
开发者ID:eugeneai,项目名称:ZCA,代码行数:16,代码来源:vc.py


注:本文中的models.Member类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。