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


Python models.BigIntegerField方法代码示例

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


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

示例1: test_max_length_warning

# 需要导入模块: from django.db import models [as 别名]
# 或者: from django.db.models import BigIntegerField [as 别名]
def test_max_length_warning(self):
        class Model(models.Model):
            integer = models.IntegerField(max_length=2)
            biginteger = models.BigIntegerField(max_length=2)
            smallinteger = models.SmallIntegerField(max_length=2)
            positiveinteger = models.PositiveIntegerField(max_length=2)
            positivesmallinteger = models.PositiveSmallIntegerField(max_length=2)

        for field in Model._meta.get_fields():
            if field.auto_created:
                continue
            with self.subTest(name=field.name):
                self.assertEqual(field.check(), [
                    DjangoWarning(
                        "'max_length' is ignored when used with %s." % field.__class__.__name__,
                        hint="Remove 'max_length' from field",
                        obj=field,
                        id='fields.W122',
                    )
                ]) 
开发者ID:nesdis,项目名称:djongo,代码行数:22,代码来源:test_ordinary_fields.py

示例2: formfield

# 需要导入模块: from django.db import models [as 别名]
# 或者: from django.db.models import BigIntegerField [as 别名]
def formfield(self, **kwargs):
        defaults = {'min_value': 0,
                    'max_value': models.BigIntegerField.MAX_BIGINT * 2 - 1}
        defaults.update(kwargs)
        return super(PositiveBigIntegerField, self).formfield(**defaults) 
开发者ID:michaelbrooks,项目名称:django-twitter-stream,代码行数:7,代码来源:fields.py

示例3: db_type

# 需要导入模块: from django.db import models [as 别名]
# 或者: from django.db.models import BigIntegerField [as 别名]
def db_type(self, connection):
        if 'mysql' in connection.__class__.__module__:
            return 'bigint UNSIGNED'
        return super(BigIntegerField, self).db_type(connection) 
开发者ID:vortessence,项目名称:vortessence,代码行数:6,代码来源:models.py

示例4: formfield

# 需要导入模块: from django.db import models [as 别名]
# 或者: from django.db.models import BigIntegerField [as 别名]
def formfield(self, **kwargs):
        defaults = {'min_value': 0,
                    'max_value': BigIntegerField.MAX_BIGINT * 2 - 1}
        defaults.update(kwargs)
        return super(PositiveBigIntegerField, self).formfield(**defaults) 
开发者ID:vortessence,项目名称:vortessence,代码行数:7,代码来源:models.py

示例5: test_should_big_integer_convert_int

# 需要导入模块: from django.db import models [as 别名]
# 或者: from django.db.models import BigIntegerField [as 别名]
def test_should_big_integer_convert_int():
    assert_conversion(models.BigIntegerField, graphene.Int) 
开发者ID:graphql-python,项目名称:graphene-django,代码行数:4,代码来源:test_converter.py

示例6: get_info

# 需要导入模块: from django.db import models [as 别名]
# 或者: from django.db.models import BigIntegerField [as 别名]
def get_info(self):
        return "HuntLog#{}: {}-{} {}".format(
            self.id, self.server, self.monster, self.log_type
        )


## class TelegramChannel(models.Model):
##     name = models.CharField(default="", max_length=64)
##     group = models.ManyToManyField(QQGroup, null=True, blank=True, related_name="tele_channel")
##     last_push_time = models.BigIntegerField(default=0)
##
##     def __str__(self):
##         return self.name 
开发者ID:Bluefissure,项目名称:FFXIVBOT,代码行数:15,代码来源:models.py

示例7: test_big_integer_field

# 需要导入模块: from django.db import models [as 别名]
# 或者: from django.db.models import BigIntegerField [as 别名]
def test_big_integer_field(self):
        field = models.BigIntegerField()
        name, path, args, kwargs = field.deconstruct()
        self.assertEqual(path, "django.db.models.BigIntegerField")
        self.assertEqual(args, [])
        self.assertEqual(kwargs, {}) 
开发者ID:denisenkom,项目名称:django-sqlserver,代码行数:8,代码来源:tests.py

示例8: test_cast_to_integer

# 需要导入模块: from django.db import models [as 别名]
# 或者: from django.db.models import BigIntegerField [as 别名]
def test_cast_to_integer(self):
        for field_class in (
            models.IntegerField,
            models.BigIntegerField,
            models.SmallIntegerField,
            models.PositiveIntegerField,
            models.PositiveSmallIntegerField,
        ):
            with self.subTest(field_class=field_class):
                numbers = Author.objects.annotate(cast_int=Cast('alias', field_class()))
                self.assertEqual(numbers.get().cast_int, 1) 
开发者ID:nesdis,项目名称:djongo,代码行数:13,代码来源:test_cast.py

示例9: test_cast_to_integer

# 需要导入模块: from django.db import models [as 别名]
# 或者: from django.db.models import BigIntegerField [as 别名]
def test_cast_to_integer(self):
        for field_class in (
            models.AutoField,
            models.BigAutoField,
            models.IntegerField,
            models.BigIntegerField,
            models.SmallIntegerField,
            models.PositiveIntegerField,
            models.PositiveSmallIntegerField,
        ):
            with self.subTest(field_class=field_class):
                numbers = Author.objects.annotate(cast_int=Cast('alias', field_class()))
                self.assertEqual(numbers.get().cast_int, 1) 
开发者ID:nesdis,项目名称:djongo,代码行数:15,代码来源:test_cast.py

示例10: run_validators

# 需要导入模块: from django.db import models [as 别名]
# 或者: from django.db.models import BigIntegerField [as 别名]
def run_validators(self, value):
        # make sure validation is performed on integer value not string value
        value = _hex_string_to_unsigned_integer(value)
        return super(models.BigIntegerField, self).run_validators(value) 
开发者ID:xtrinch,项目名称:fcm-django,代码行数:6,代码来源:fields.py

示例11: AsInt

# 需要导入模块: from django.db import models [as 别名]
# 或者: from django.db.models import BigIntegerField [as 别名]
def AsInt(expr):
    return Cast(expr, BigIntegerField()) 
开发者ID:SFDO-Tooling,项目名称:MetaCI,代码行数:4,代码来源:testmethod_perf.py


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