Explicitly limit asn integer

This commit is contained in:
Michael Shamoon 2023-01-23 20:28:12 -08:00 committed by Trenton H
parent f1da573a41
commit 462dffe25f
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,30 @@
# Generated by Django 4.1.4 on 2023-01-24 05:09
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("documents", "1028_remove_paperlesstask_task_args_and_more"),
]
operations = [
migrations.AlterField(
model_name="document",
name="archive_serial_number",
field=models.PositiveIntegerField(
blank=True,
db_index=True,
help_text="The position of this document in your physical document archive.",
null=True,
unique=True,
validators=[
django.core.validators.MaxValueValidator(2147483647),
django.core.validators.MinValueValidator(0),
],
verbose_name="archive serial number",
),
),
]

View File

@ -10,6 +10,8 @@ import pathvalidate
from celery import states
from django.conf import settings
from django.contrib.auth.models import User
from django.core.validators import MaxValueValidator
from django.core.validators import MinValueValidator
from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
@ -227,12 +229,16 @@ class Document(models.Model):
help_text=_("The original name of the file when it was uploaded"),
)
archive_serial_number = models.IntegerField(
archive_serial_number = models.PositiveIntegerField(
_("archive serial number"),
blank=True,
null=True,
unique=True,
db_index=True,
validators=[
MaxValueValidator(2147483647),
MinValueValidator(0),
],
help_text=_(
"The position of this document in your physical document " "archive.",
),