本文整理汇总了Python中models.Site.name方法的典型用法代码示例。如果您正苦于以下问题:Python Site.name方法的具体用法?Python Site.name怎么用?Python Site.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Site
的用法示例。
在下文中一共展示了Site.name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sites
# 需要导入模块: from models import Site [as 别名]
# 或者: from models.Site import name [as 别名]
def sites():
root_domain = app.config.get("DOMAIN_ROOT")
port = app.config.get("PORT", None)
if request.method == "POST":
domain = request.form["domain"]
name = request.form["name"]
if domain and name:
site = Site()
site.name = name.strip()
site.domain = domain.strip()
conflicting_site = Site.objects.filter(domain=site.domain).first()
if not conflicting_site:
site.description = _(
"<h1>Introductory text</h1><p>This should "
"contain simple help about what is changeable and how."
"</p>"
)
site.save()
url = "//%s" % site.domain
if root_domain:
url += ".%s" % root_domain
if port:
url += ":%d" % port
return redirect(url)
return redirect(url_for("sites"))
if root_domain == g.site.domain:
sites = Site.objects.all()
else:
sites = Site.objects.filter(domain__endswith=g.site.domain)
return render_template("sites.html", sites=sites, root_domain=root_domain, port=port)
示例2: _tx
# 需要导入模块: from models import Site [as 别名]
# 或者: from models.Site import name [as 别名]
def _tx():
site = Site.get_by_key_name(loc["id"])
if site is None:
site = Site(key_name=loc["id"])
site.location = GeoPt(lat = loc["location"][0], lon = loc["location"][1])
site.name = loc["name"]
site.region = loc["region"]
site.save()
示例3: get_site
# 需要导入模块: from models import Site [as 别名]
# 或者: from models.Site import name [as 别名]
def get_site():
try:
site = Site.objects.get(name=EbaySpider.name)
except DoesNotExist as e:
logging.info(">>>> Creating site")
site = Site()
site.name = EbaySpider.name
return site