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


Python Service.slug方法代码示例

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


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

示例1: Region

# 需要导入模块: from models import Service [as 别名]
# 或者: from models.Service import slug [as 别名]
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

from google.appengine.ext import db
from models import Status, Service, Event, Region
from datetime import datetime, timedelta, date

na = Region(name="North America")
na.put()

emea = Region(name="EMEA")
emea.put()

foo = Service(name="Service Foo", slug="service-foo", region=na,
              description="Scalable and reliable foo service across the globe")
foo.slug = Service.slugify(foo.name, foo.region.name)
foo.put()

bar = Service(name="Service Bar", slug="service-bar", region=emea,
             description="Scalable and reliable foo service")
bar.slug = Service.slugify(bar.name, bar.region.name)
bar.put()

delete = Service(name="Delete Me", slug="delete", region=na,
                description="Delete Me Please")
delete.slug = Service.slugify(delete.name, delete.region.name)
delete.put()

bar = Service.get_by_slug("emea-service-bar")
cat = Status.get_by_slug("down")        
开发者ID:samn,项目名称:stashboard,代码行数:32,代码来源:install_data.py


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