Collection/item uid: allow base64-url not just base62.

This commit is contained in:
Tom Hacohen 2020-06-24 10:48:47 +03:00
parent 2da49bb95e
commit 1bed39af9d
2 changed files with 20 additions and 1 deletions

View File

@ -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\\-_]*$')]),
),
]

View File

@ -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.') 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): class Collection(models.Model):