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


Python models.List类代码示例

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


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


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