diff --git a/journals/behaviors.py b/journals/behaviors.py new file mode 100644 index 0000000000000000000000000000000000000000..eca874354c8a6458dd3fa6804c38f7770c65e2a7 --- /dev/null +++ b/journals/behaviors.py @@ -0,0 +1,12 @@ +from django.core.validators import RegexValidator + +doi_journal_validator = RegexValidator(r'^[a-zA-Z]+$', + 'Only valid DOI expressions are allowed ([a-zA-Z]+).') +doi_volume_validator = RegexValidator(r'^[a-zA-Z]+.[0-9]+$', + 'Only valid DOI expressions are allowed ([a-zA-Z]+.[0-9]+).') +doi_issue_validator = RegexValidator(r'^[a-zA-Z]+.[0-9]+.[0-9]+$', + ('Only valid DOI expressions are allowed ' + '([a-zA-Z]+.[0-9]+.[0-9]+).')) +doi_publication_validator = RegexValidator(r'^[a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,}$', + ('Only valid DOI expressions are allowed ' + '([a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,}).')) diff --git a/journals/migrations/0015_auto_20170408_1758.py b/journals/migrations/0015_auto_20170408_1758.py new file mode 100644 index 0000000000000000000000000000000000000000..6ece95f4450f48a1e80c89daba6bb14980fd219b --- /dev/null +++ b/journals/migrations/0015_auto_20170408_1758.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2017-04-08 15:58 +from __future__ import unicode_literals + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('journals', '0014_journal_active'), + ] + + operations = [ + migrations.AlterField( + model_name='issue', + name='doi_string', + field=models.CharField(db_index=True, max_length=200, unique=True, validators=[django.core.validators.RegexValidator('^[a-zA-Z]+.[0-9]+.[0-9]+$', 'Only valid DOI expressions are allowed ([a-zA-Z]+.[0-9]+.[0-9]+).')]), + ), + migrations.AlterField( + model_name='journal', + name='doi_string', + field=models.CharField(db_index=True, max_length=200, unique=True, validators=[django.core.validators.RegexValidator('^[a-zA-Z]+$', 'Only valid DOI expressions are allowed ([a-zA-Z]+).')]), + ), + migrations.AlterField( + model_name='publication', + name='doi_string', + field=models.CharField(db_index=True, max_length=200, unique=True, validators=[django.core.validators.RegexValidator('^[a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,}$', 'Only valid DOI expressions are allowed ([a-zA-Z]+.[0-9]+.[0-9]+.[0-9]{3,}).')]), + ), + migrations.AlterField( + model_name='volume', + name='doi_string', + field=models.CharField(db_index=True, max_length=200, unique=True, validators=[django.core.validators.RegexValidator('^[a-zA-Z]+.[0-9]+$', 'Only valid DOI expressions are allowed ([a-zA-Z]+.[0-9]+).')]), + ), + ]