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


Python app.models方法代码示例

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


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

示例1: ping

# 需要导入模块: from app import app [as 别名]
# 或者: from app.app import models [as 别名]
def ping(service_id):
     
    from app import db, models
    from models import Service
    finding = Service.query.filter_by(serviceid=service_id).first()
    if finding is not None:
        image_name = finding.imagename
        uploadn = finding.uploadname
        usern = finding.username
        firstcreatetime = finding.firstcreatetime
        u = Service(serviceid = service_id, createdtime = str(time.time()), imagename = image_name, uploadname = uploadn, username = usern, firstcreatetime = firstcreatetime)
        db.session.add(u) 
        db.session.commit() 
        db.session.delete(finding)
        db.session.commit()
    else:
        return "The service "+service_id+" has been removed!"
    
    return "There are existing service:"+service_id 
开发者ID:cyberdb,项目名称:Cloudroid,代码行数:21,代码来源:views.py

示例2: setting

# 需要导入模块: from app import app [as 别名]
# 或者: from app.app import models [as 别名]
def setting():
    from app.forms import SetForm
    
    form = SetForm()
    if form.validate_on_submit():
        servers = models.ServerIP.query.all()
        for server in servers:
            db.session.delete(server)
            db.session.commit()
        serverip = form.ip.data
        u = models.ServerIP(serverip = serverip)
        db.session.add(u)
        db.session.commit()
        return render_template('setting.html',form=form, succeed = True)
    return render_template('setting.html',form=form) 
开发者ID:cyberdb,项目名称:Cloudroid,代码行数:17,代码来源:views.py

示例3: images

# 需要导入模块: from app import app [as 别名]
# 或者: from app.app import models [as 别名]
def images():
    from app import db, models         
    images = models.Image.query.all()
    result = []
    part_line = {'imagename':'default','uploadname':'default','uploaduser':'default','comments':'default'}
    for i in images:
        part_line['imagename'] = i.imagename
        part_line['uploadname'] = i.uploadname
        part_line['uploaduser'] = i.uploaduser
        part_line['comments'] = i.comments
        result.append(part_line)
        part_line = {}
    return render_template('images.html',imagetables = result) 
开发者ID:cyberdb,项目名称:Cloudroid,代码行数:15,代码来源:views.py

示例4: idetailed

# 需要导入模块: from app import app [as 别名]
# 或者: from app.app import models [as 别名]
def idetailed(image_name):
    from app import db, models 
    
    image = models.Image.query.filter_by(imagename = image_name).first()
    published_topics = StringToListOfDict(image.published_topics)
    subscribed_topics = StringToListOfDict(image.subscribed_topics)
    pub_topic_list = []
    sub_topic_list = []
    for pub_topic in published_topics:
	    pub_topic_list.append(pub_topic.get("topic_name"))
    for sub_topic in subscribed_topics:
	    sub_topic_list.append(sub_topic.get("topic_name"))

    return render_template('idetailed.html',imagename = image.imagename, uploadname = image.uploadname, uploaduser = image.uploaduser, uploadtime = image.uploadtime, subscribed_topics = sub_topic_list, published_topics = pub_topic_list, advertised_services = StringToList(image.advertised_services), advertised_actions = StringToList(image.advertised_actions), comments = image.comments) 
开发者ID:cyberdb,项目名称:Cloudroid,代码行数:16,代码来源:views.py


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