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


Python Report.content方法代码示例

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


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

示例1: set_report

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import content [as 别名]
def set_report(name, content):
	report = Report.find_by_name(name)
	if report is None:
		report = Report()
		report.name = name

	report.content = content
	report.put()
开发者ID:armandomiani,项目名称:flask-appengine-bootstrap,代码行数:10,代码来源:mm.py

示例2: addreport

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import content [as 别名]
def addreport(request):
    if request.method == 'POST':
        form = ReportForm(request.POST)
        if form.is_valid():
            report = Report() 
            report.headline = form.cleaned_data.get("headline")
            report.content = form.cleaned_data.get("content")
            report.reporter = request.user.username
            report.date = datetime.now()
            report.save()
            return HttpResponseRedirect(reverse('news:index'))
    else:
        form = ReportForm()

    return render_to_response('news/addreport.html', {'form':form}, context_instance=RequestContext(request))
开发者ID:lite,项目名称:djsite,代码行数:17,代码来源:views.py

示例3: api_submit

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import content [as 别名]
def api_submit():
    try:
        if not (0 <= int(request.form["type"]) < len(REPORT_TYPES)):
            raise Exception("Invalid report type %s" % request.form["type"])
        report = Report()
        report.report_type = int(request.form["type"])

        if "content" in request.form:
            report.content = request.form["content"]

        if "location" in request.form:
            loc = request.form["location"].split(',')
            report.geo_lat, report.geo_lng = float(loc[0]), float(loc[1])
            report.set_city()

        db.session.add(report)
        db.session.commit()

        img = request.files.get("photo", None)
        if img:
            img.save(os.path.join(app.config["IMAGE_FOLDER"], repr(report.id) + ".png"))
            report.img_src = repr(report.id) + ".png" 

        vid = request.files.get("video", None)
        if vid:
            vid.save(os.path.join(app.config["VIDEO_FOLDER"], repr(report.id) + ".avi"))
            report.vid_src = repr(report.id) + ".avi" 

        db.session.commit()

        logger.info("API: Report %d was created", report.id)

        return "%d" % report.id

    except Exception, e:
        logger.error("API: Report creation failed")
        logger.error("Exception: %s", str(e))
        res = Response(status = 500)
        return res
开发者ID:avacariu,项目名称:watchermelon,代码行数:41,代码来源:views.py


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