mirror of
https://github.com/jazzband/django-eav2.git
synced 2026-03-16 22:40:26 +00:00
Allow for integer values larger than 32-bits (#137)
* style: apply ignores to all migrations * feat: support 64-bit integers * doc: update changelog * test: add test for bigger than 32-bit integer
This commit is contained in:
parent
6416477dad
commit
ed7a808ee8
5 changed files with 33 additions and 2 deletions
|
|
@ -6,6 +6,8 @@ We follow [Semantic Versions](https://semver.org/) starting at the `0.14.0` rele
|
|||
|
||||
### Features
|
||||
|
||||
- Adds 64-bit support for `Value.value_int`
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
### Misc
|
||||
|
|
|
|||
17
eav/migrations/0007_alter_value_value_int.py
Normal file
17
eav/migrations/0007_alter_value_value_int.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
"""Convert Value.value_int to BigInteger."""
|
||||
|
||||
dependencies = [
|
||||
('eav', '0006_add_entity_uuid'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='value',
|
||||
name='value_int',
|
||||
field=models.BigIntegerField(blank=True, null=True),
|
||||
),
|
||||
]
|
||||
|
|
@ -443,7 +443,7 @@ class Value(models.Model): # noqa: WPS110
|
|||
value_csv = CSVField(blank=True, null=True)
|
||||
value_date = models.DateTimeField(blank=True, null=True)
|
||||
value_float = models.FloatField(blank=True, null=True)
|
||||
value_int = models.IntegerField(blank=True, null=True)
|
||||
value_int = models.BigIntegerField(blank=True, null=True)
|
||||
value_text = models.TextField(blank=True, null=True)
|
||||
|
||||
value_json = JSONField(
|
||||
|
|
|
|||
|
|
@ -39,7 +39,9 @@ ignore =
|
|||
DAR203
|
||||
|
||||
per-file-ignores =
|
||||
test_project/migrations/*.py: N806, WPS102, WPS114
|
||||
# Allow to have magic numbers inside migrations and wrong module names:
|
||||
*/migrations/*.py: WPS102, WPS114, WPS432
|
||||
# Allow `__init__.py` with logic for configuration:
|
||||
test_project/settings.py: S105, WPS226, WPS407
|
||||
tests/test_*.py: N806, S101, S404, S603, S607, WPS118, WPS226, WPS432, WPS442
|
||||
|
||||
|
|
|
|||
|
|
@ -99,3 +99,13 @@ class Attributes(TestCase):
|
|||
v1 = Value.objects.filter(entity_uuid=d1.pk).first()
|
||||
assert isinstance(repr(v1), str)
|
||||
assert isinstance(str(v1), str)
|
||||
|
||||
def test_big_integer(self):
|
||||
"""Tests an integer larger than 32-bit a value."""
|
||||
big_num = 3147483647
|
||||
patient = Patient.objects.create(name='Jon')
|
||||
patient.eav.age = big_num
|
||||
|
||||
patient.save()
|
||||
|
||||
assert patient.eav.age == big_num
|
||||
|
|
|
|||
Loading…
Reference in a new issue