本文整理汇总了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")