• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python models.List类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: create_tables

def create_tables():
    Number.create_table(True)
    SMS.create_table(True)
    Seller.create_table(True)
    Market.create_table(True)
    List.create_table(True)
    ListRelationship.create_table(True)
    Outbox.create_table(True)
开发者ID:elizabethmgin,项目名称:bugolobi_GIT,代码行数:8,代码来源:views.py


示例2: data

    def data(self):
        services = []
        default_status = Status.get_default()

        lists = []
        for list in self.lists:
            l = List.get_by_slug(list)
            if l is not None:
                lists.append(l)

        for service in Service.all().filter("list IN", lists).order("name").fetch(100):
            event = service.current_event()
            if event is not None:
                status = event.status
            else:
                status = default_status

            if len(self.statuses) and not status.slug in self.statuses:
                continue

            today = date.today() + timedelta(days=1)
            current, = service.history(1, default_status, start=today)
            has_issues = current["information"] and status.key() == default_status.key()

            service_dict = {
                "slug": service.slug,
                "name": service.name,
                "url": service.url(),
                "status": status,
                "has_issues": has_issues,
                "history": service.history(5, default_status),
            }
            services.append(service_dict)

        return {"days": get_past_days(5), "statuses": Status.all().fetch(100), "services": services}
开发者ID:azenk,项目名称:stashboard,代码行数:35,代码来源:site.py


示例3: post

    def post(self, version):
        if not self.valid_version(version):
            self.error(404, "API Version %s not supported" % version)
            return

        name = self.request.get('name', default_value=None)
        description = self.request.get('description', default_value=None)

        if not name or not description:
            self.error(400, "Bad Data: Name: %s, Description: %s" \
                           % (name, description))
            return

        slug = slugify.slugify(name)
        existing_s = List.get_by_slug(slug)

        if existing_s:
            self.error(404, "A list with this name already exists")
            return

        l = List(name=name, slug=slug, description=description)
        l.put()

        invalidate_cache()

        self.response.set_status(201)
        self.json(l.rest(self.base_url(version)))
开发者ID:Tradeshift,项目名称:stashboard,代码行数:27,代码来源:api.py


示例4: _get_all

	def _get_all(self):
		_lists = objList.get_all()

		if not _lists:
			return make_response(dumps([]))

		return make_response(dumps(_lists))
开发者ID:sgricci,项目名称:task-api,代码行数:7,代码来源:List.py


示例5: post

	def post(self):		
		args = parser.parse_args()
		if not args.name:
			abort(500)

		_l = objList.add(args.name)
		return _l
开发者ID:sgricci,项目名称:task-api,代码行数:7,代码来源:List.py


示例6: test_post_update_desc

    def test_post_update_desc(self):
        response = self.post("/admin/api/v1/service-lists/foo",
                data={"description": "hello"})
        self.assertEquals(response.headers["Content-Type"], "application/json")
        self.assertEquals(response.status_code, 200)

        service = List.get(self.service_list.key())
        self.assertEquals(service.description, "hello")
开发者ID:2do,项目名称:stashboard,代码行数:8,代码来源:test_service_lists.py


示例7: get

  def get(self):
    results = []
    q = List.query()
    for list in q.iter():
      results.append(list.to_dict())

    self.response.headers['Content-Type'] = 'application/json'
    self.response.out.write(json.dumps(results));
开发者ID:uschackers,项目名称:web-hackschool-f2014,代码行数:8,代码来源:lists_handler.py


示例8: test_post_update

    def test_post_update(self):
        response = self.post("/admin/api/v1/service-lists/foo",
                    data={"name": "bar"})
        self.assertEquals(response.headers["Content-Type"], "application/json")
        self.assertEquals(response.status_code, 200)

        service = List.get(self.service_list.key())
        self.assertEquals(service.name, "bar")
开发者ID:2do,项目名称:stashboard,代码行数:8,代码来源:test_service_lists.py


示例9: get

    def get(self, version):
        if not self.valid_version(version):
            self.error(404, "API Version %s not supported" % version)
            return

        query = List.all().order('name')
        data = [s.rest(self.base_url(version)) for s in query]
        data = {"lists": data}
        self.json(data)
开发者ID:Tradeshift,项目名称:stashboard,代码行数:9,代码来源:api.py


示例10: get

    def get(self):
        lists = List.query().fetch(20)

        newList = []
        for item in lists:
            newList.append({"name": item.name,
                            "listKey": item.key.urlsafe()})
        
        self.response.write(json.dumps(newList))
开发者ID:murph,项目名称:collab-list,代码行数:9,代码来源:main.py


示例11: get

    def get(self):
        td = {
            "services_selected": True,
            "url": "/admin/api/v1/services",
            "action": "create",
            "service_lists": List.all().fetch(100),
            }

        td.update(site.default_template_data())
        self.render(td, 'admin/services_create.html')
开发者ID:Homefinder,项目名称:stashboard,代码行数:10,代码来源:admin.py


示例12: put

	def put(self, list_id=None):
		if not list_id:
			abort(500)
		args = parser.parse_args()
		if not args.name:
			abort(500)

		_l = objList.update(list_id, args.name)

		return _l
开发者ID:sgricci,项目名称:task-api,代码行数:10,代码来源:List.py


示例13: get

    def get(self, list_slug):
        self.list = List.get_by_slug(list_slug)

        if self.list is None:
            self.not_found()
            return

        td = default_template_data()
        td.update(self.retrieve("list"+list_slug))
        #td.update(self.data())
        self.render(td, 'index.html')
开发者ID:Labgoo,项目名称:stashboard,代码行数:11,代码来源:site.py


示例14: data

    def data(self):
        default_status = Status.get_default()

        lists = []
        for list in self.lists:
            l = List.get_by_slug(list)
            if l is not None:
                lists.append(l)

        @ndb.toplevel
        def get_services():
            services = []
            for service in Service.query().filter(Service.list in lists).order(Service.name).fetch(100):
                event = yield service.current_event_async()
                if event is not None:
                    status = event.status
                else:
                    status = default_status

                if len(self.statuses) and not status.slug in self.statuses: continue

                today = datetime.today() + timedelta(days=1)
                current = yield service.history_async(1, default_status, start=today)
                
                current = current[0]

                has_issues = current["information"] and status.key == default_status.key

                history = yield service.history_async(5, default_status)

                service_dict = {
                    "slug": service.slug,
                    "name": service.name,
                    "url": service.url(),
                    "status": status,
                    "has_issues": has_issues,
                    "history": history,
                    }
                services.append(service_dict)

            raise ndb.Return(services)

        return {
            "days": get_past_days(5),
            "statuses": Status.query().fetch(100),
            "services": get_services(),
            }
开发者ID:Labgoo,项目名称:stashboard,代码行数:47,代码来源:site.py


示例15: delete

    def delete(self, version, list_slug):
        if not self.valid_version(version):
            self.error(404, "API Version %s not supported" % version)
            return

        list = List.get_by_slug(list_slug)

        if not list:
            self.error(404, "List %s not found" % list_slug)
            return

        query = Service.query().filter(Service.list == list)
        for s in query:
            s.list = None
            s.put()

        invalidate_cache()
        list.delete()
        self.json(list.rest(self.base_url(version)))
开发者ID:Labgoo,项目名称:stashboard,代码行数:19,代码来源:api.py


示例16: index

def index(password):
    print >> sys.stderr, "within index"
    try:
        if password == PASSWORD:
            print >> sys.stderr, "within try"
            sellerList = Seller.select()
            smsList = SMS.select()
            numberList = Number.select()
            l = List.select()
            marketList = Market.select()
            lrList = ListRelationship.select()
            outboxList = Outbox.select()
            return render_template("index.html", title = 'TABLES', sellerList = sellerList, smsList = smsList, l = l, marketList = marketList)
            #return 'hello world'
        else:
            print >> sys.stderr, "wrong password"
    except:
        print >> sys.stderr, "within except"
        print >> sys.stderr, str(sys.exc_info()[0]) # These write the nature of the error
        print >> sys.stderr, str(sys.exc_info()[1])
        statement = 'An exception has Occured'+ str(sys.exc_type) + '[' + str(sys.exc_value) + ']'
        return statement
开发者ID:elizabethmgin,项目名称:bugolobi_GIT,代码行数:22,代码来源:views.py


示例17: check_Mini_Sellers_ListName_Exists

def check_Mini_Sellers_ListName_Exists(seller, name):
    for l in List.select():
        if l.seller == seller and l.name == name:
            print 'seller already created this list!'
            return True
开发者ID:elizabethmgin,项目名称:bugolobi_GIT,代码行数:5,代码来源:views.py


示例18: get_Mini_Sellers_List

def get_Mini_Sellers_List(seller, name):
    l = List.get(List.name == name and List.seller == seller)
    return l
开发者ID:elizabethmgin,项目名称:bugolobi_GIT,代码行数:3,代码来源:views.py


示例19: get_Mini_List

def get_Mini_List(name):
    l = List.get(List.name == name)
    return l
开发者ID:elizabethmgin,项目名称:bugolobi_GIT,代码行数:3,代码来源:views.py


示例20: get_List_Object

def get_List_Object(market):
    listObject = List.get(List.market == market)
    return listObject
开发者ID:elizabethmgin,项目名称:bugolobi_GIT,代码行数:3,代码来源:views.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python models.Location类代码示例发布时间:2022-05-27
下一篇:
Python models.Link类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap