Skip to content

Commit

Permalink
Merge pull request #2043 from MIT-LCP/lm/affi
Browse files Browse the repository at this point in the history
Increase maximum character length for affiliations
  • Loading branch information
tompollard authored Jul 11, 2023
2 parents 2ed0de4 + ebe1c05 commit 40dc4e0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion physionet-django/project/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ class AffiliationFormSet(forms.BaseInlineFormSet):
"""
form_name = 'affiliations'
item_label = 'Affiliations'
max_forms = 3
max_forms = Affiliation.MAX_AFFILIATIONS

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down
18 changes: 18 additions & 0 deletions physionet-django/project/migrations/0068_auto_20230711_1651.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.14 on 2023-07-11 20:51

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('project', '0067_alter_activeproject_core_project_and_more'),
]

operations = [
migrations.AlterField(
model_name='contact',
name='affiliations',
field=models.CharField(max_length=612),
),
]
1 change: 1 addition & 0 deletions physionet-django/project/modelcomponents/authors.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Affiliation(models.Model):
Affiliations belonging to an author
"""
MAX_LENGTH = 202
MAX_AFFILIATIONS = 3
name = models.CharField(max_length=MAX_LENGTH,
validators=[validate_affiliation])
author = models.ForeignKey('project.Author', related_name='affiliations',
Expand Down
3 changes: 2 additions & 1 deletion physionet-django/project/modelcomponents/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from html2text import html2text
from project.modelcomponents.access import AccessPolicy, AnonymousAccess
from project.modelcomponents.fields import SafeHTMLField
from project.modelcomponents.authors import Affiliation
from project.projectfiles import ProjectFiles
from project.utility import LinkFilter, get_directory_info, get_file_info, list_items
from project.validators import validate_title, validate_topic, validate_version
Expand Down Expand Up @@ -620,7 +621,7 @@ class Contact(models.Model):
Contact for a PublishedProject
"""
name = models.CharField(max_length=120)
affiliations = models.CharField(max_length=150)
affiliations = models.CharField(max_length=(Affiliation.MAX_AFFILIATIONS * (Affiliation.MAX_LENGTH + 2)))
email = models.EmailField(max_length=255)
project = models.OneToOneField('project.PublishedProject',
related_name='contact', on_delete=models.CASCADE)
Expand Down

0 comments on commit 40dc4e0

Please sign in to comment.