From 1bed39af9d3d4205d15d42947cbedc6a52cb1fc2 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 24 Jun 2020 10:48:47 +0300 Subject: [PATCH] Collection/item uid: allow base64-url not just base62. --- .../migrations/0018_auto_20200624_0748.py | 19 +++++++++++++++++++ django_etebase/models.py | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 django_etebase/migrations/0018_auto_20200624_0748.py diff --git a/django_etebase/migrations/0018_auto_20200624_0748.py b/django_etebase/migrations/0018_auto_20200624_0748.py new file mode 100644 index 0000000..ec59e0c --- /dev/null +++ b/django_etebase/migrations/0018_auto_20200624_0748.py @@ -0,0 +1,19 @@ +# Generated by Django 3.0.3 on 2020-06-24 07:48 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('django_etebase', '0017_auto_20200623_0958'), + ] + + operations = [ + migrations.AlterField( + model_name='collectionitem', + name='uid', + field=models.CharField(db_index=True, max_length=43, validators=[django.core.validators.RegexValidator(message='Not a valid UID', regex='^[a-zA-Z0-9\\-_]*$')]), + ), + ] diff --git a/django_etebase/models.py b/django_etebase/models.py index 87b0ed1..5f7a6f2 100644 --- a/django_etebase/models.py +++ b/django_etebase/models.py @@ -23,7 +23,7 @@ from django.utils.crypto import get_random_string Base64Url256BitlValidator = RegexValidator(regex=r'^[a-zA-Z0-9\-_]{42,43}$', message='Expected a base64url.') -UidValidator = RegexValidator(regex=r'^[a-zA-Z0-9]*$', message='Not a valid UID') +UidValidator = RegexValidator(regex=r'^[a-zA-Z0-9\-_]*$', message='Not a valid UID') class Collection(models.Model):