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


Python Category.delete方法代码示例

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


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

示例1: syncdb

# 需要导入模块: from model import Category [as 别名]
# 或者: from model.Category import delete [as 别名]
def syncdb():
    from lib.util import find_subclasses
    from model import db, User, Distribution, Category, Page
    
    models = find_subclasses(db.Model)
    for model in models:
        if model.table_exists():
            model.drop_table()
        model.create_table()
        logging.info('created table:%s' % model._meta.db_table)
    
    User.create(mobile = 'root', password = User.create_password('111111'), group = 9)
    Distribution.create(name = '免费配送', price = 0)
    Distribution.create(name = '上门自提', price = 0)
    Category.create(name = '积分商品', slug = 'credit', order = 1)
    Category.create(name = '搭配购买', slug = 'acc', order = 2)
    Category.create(name = '鸡', slug = 'ji', order = 3)
    Category.create(name = '鸭', slug = 'ya', order = 4)
    Category.create(name = '鹅', slug = 'e', order = 5)
    Category.delete().where(Category.id == 1).execute() 
    Category.delete().where(Category.id == 2).execute()
    #Category.create(name = '乳脂奶油蛋糕', slug = 'creambutter', order = 6)
    #Category.create(name = '冰淇淋蛋糕', slug = 'icecream', order = 7)
    Page.create(name = '菜市优品', slug = 'aboutus', content = '')
    Page.create(name = '包装展示', slug = 'bzzs', content = '')
    Page.create(name = '订购说明', slug = 'dgsm', content = '')
    Page.create(name = '如何收货', slug = 'rhsh', content = '')
    Page.create(name = '付款方式', slug = 'fkfs', content = '')
    Page.create(name = '配送范围', slug = 'psfw', content = '')
    
    logging.info('superuser - username:root password:111111')
开发者ID:yanjinjin,项目名称:wxshop,代码行数:33,代码来源:manager.py

示例2: api_category_delete

# 需要导入模块: from model import Category [as 别名]
# 或者: from model.Category import delete [as 别名]
def api_category_delete(*, request, category_id):
    r = web.Response()
    category = Category(id=category_id)
    category_result = yield from category.delete()
    if int(category_id) > 0 and int(category_result) > 0:
        result = APIResult(1, '', '删除成功')
    else:
        result = APIResult(0, '', '删除失败')
    return jsonResult(r, result)
开发者ID:hearain528,项目名称:blog,代码行数:11,代码来源:handlers.py

示例3: get

# 需要导入模块: from model import Category [as 别名]
# 或者: from model.Category import delete [as 别名]
 def get(self, cid):
     Category.delete().where(Category.id == cid).execute()
     CategoryAttr.delete().where(CategoryAttr.cid == cid).execute()
     self.memcachedb.delete('categorys')
     self.flash(u"分类删除成功")
     self.redirect("/admin/categorys")
开发者ID:FashtimeDotCom,项目名称:cakeshop,代码行数:8,代码来源:admin.py


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