Skip to content

Commit 7d91cfc

Browse files
committed
WIP
1 parent 052ebb2 commit 7d91cfc

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

requirements/prod_20_04.pip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ rsa==4.7.2
100100
scandir==1.5
101101
scikit-learn==0.21.3
102102
scipy==1.1.0
103+
shortuuid==1.0.11
103104
simplegeneric==0.8.1
104105
simplejson==3.17.2
105106
six==1.16.0

tigaserver_app/models.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from django.utils.timezone import utc
2828
from django.utils.translation import ugettext_lazy as _
2929

30+
from shortuuid.django_fields import ShortUUIDField
3031
from simple_history.models import HistoricalRecords
3132

3233
from common.translation import get_translation_in, get_locale_for_native
@@ -482,9 +483,11 @@ class Report(models.Model):
482483
editable=False,
483484
help_text='-1 if deleted, otherwise 0.'
484485
)
485-
report_id = models.CharField(
486-
max_length=4,
486+
report_id = ShortUUIDField(
487+
length=11,
488+
unique=True,
487489
db_index=True,
490+
alphabet="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-", # NOTE: safe URL characters from https://zelark.github.io/nano-id-cc/
488491
help_text="4-digit alpha-numeric code generated on user phone to identify each unique report from that user. Digits should lbe randomly drawn from the set of all lowercase and uppercase alphabetic characters and 0-9, but excluding 0, o, and O to avoid confusion if we ever need user to be able to refer to a report ID in correspondence with MoveLab (as was previously the case when we had them sending samples).",
489492
)
490493

0 commit comments

Comments
 (0)