Skip to content

Commit

Permalink
Merge pull request #855 from uktrade/LTD-1370
Browse files Browse the repository at this point in the history
  • Loading branch information
Manos authored Nov 9, 2021
2 parents 94db5df + 3a012ee commit 107ce59
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
12 changes: 12 additions & 0 deletions api/parties/migrations/0002_remove_name_length_limit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Generated by Django 3.1.12 on 2021-11-09 12:58

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [("parties", "0001_squashed_0011_party_signatory_name_euu")]

operations = [
migrations.AlterField(model_name="party", name="name", field=models.TextField(blank=True, default=""))
]
4 changes: 2 additions & 2 deletions api/parties/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ def copy_detail(self, pk):

class Party(TimestampableModel):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
name = models.CharField(default=None, blank=True, max_length=100)
name = models.TextField(default="", blank=True)
address = models.TextField(default=None, blank=True, max_length=256)
country = models.ForeignKey(Country, on_delete=models.CASCADE)
website = models.URLField(default=None, blank=True, null=True)
signatory_name_euu = models.TextField(blank=True)
type = models.CharField(choices=PartyType.choices, max_length=20)
organisation = models.ForeignKey(
Organisation, blank=True, null=True, related_name="organisation_party", on_delete=models.DO_NOTHING,
Organisation, blank=True, null=True, related_name="organisation_party", on_delete=models.DO_NOTHING
)
flags = models.ManyToManyField(Flag, related_name="parties")
role = models.CharField(
Expand Down
6 changes: 6 additions & 0 deletions api/parties/tests/test_parties.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class TestParty:
def test_name_length_permissive(self, party_factory):
"""Ensure we allow longer names (we used to have a 100-char limit)"""
assert party_factory(name="short name")
assert party_factory(name="a" * 100)
assert party_factory(name="a" * 1024)

0 comments on commit 107ce59

Please sign in to comment.