本文整理汇总了Python中versions.models.Version.save方法的典型用法代码示例。如果您正苦于以下问题:Python Version.save方法的具体用法?Python Version.save怎么用?Python Version.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类versions.models.Version
的用法示例。
在下文中一共展示了Version.save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_large_version_int
# 需要导入模块: from versions.models import Version [as 别名]
# 或者: from versions.models.Version import save [as 别名]
def test_large_version_int(self):
# This version will fail to be written to the version_int
# table because the resulting int is bigger than mysql bigint.
version = Version(addon=Addon.objects.get(pk=337141))
version.version = '9223372036854775807'
version.save()
eq_(version.version_int, None)
示例2: create_version
# 需要导入模块: from versions.models import Version [as 别名]
# 或者: from versions.models.Version import save [as 别名]
def create_version(self, license=None):
data = self.cleaned_data
v = Version(addon=self.addon, license=license, version=data["version"], releasenotes=data["release_notes"])
v.save()
amo.log(amo.LOG.ADD_VERSION, v.addon, v)
self._save_apps(v)
self._save_file(v)
return v
示例3: _extra_version_and_file
# 需要导入模块: from versions.models import Version [as 别名]
# 或者: from versions.models.Version import save [as 别名]
def _extra_version_and_file(self, status):
version = Version.objects.get(id=81551)
version_two = Version(addon=self.addon, license=version.license, version="1.2.3")
version_two.save()
file_two = File(status=status, version=version_two)
file_two.save()
return version_two, file_two
示例4: create_version
# 需要导入模块: from versions.models import Version [as 别名]
# 或者: from versions.models.Version import save [as 别名]
def create_version(self, license=None):
data = self.cleaned_data
v = Version(addon=self.addon, license=license,
version=data['version'],
releasenotes=data['release_notes'])
v.save()
self._save_apps(v)
self._save_file(v)
return v
示例5: create_file
# 需要导入模块: from versions.models import Version [as 别名]
# 或者: from versions.models.Version import save [as 别名]
def create_file(self, **kwargs):
addon = Addon()
addon.save()
ver = Version(version='0.1')
ver.addon = addon
ver.save()
f = File(**kwargs)
f.version = ver
f.save()
return f
示例6: test_version_log_transformer
# 需要导入模块: from versions.models import Version [as 别名]
# 或者: from versions.models.Version import save [as 别名]
def test_version_log_transformer(self):
addon = Addon.objects.get()
version = addon.latest_version
amo.log(amo.LOG.REJECT_VERSION, addon, version,
user=self.request.amo_user)
version_two = Version(addon=addon, license=version.license,
version='1.2.3')
version_two.save()
amo.log(amo.LOG.REJECT_VERSION, addon, version_two,
user=self.request.amo_user)
versions = (Version.objects.filter(addon=addon).order_by('-created')
.transform(Version.transformer_activity))
eq_(len(versions[0].all_activity), 1)
eq_(len(versions[1].all_activity), 1)