diff --git a/archive_api/serializers.py b/archive_api/serializers.py index 38f3e1de..b9820ebb 100644 --- a/archive_api/serializers.py +++ b/archive_api/serializers.py @@ -148,7 +148,7 @@ def validate(self, data): # Make sure description has at least 100 words if 'description' in data.keys() and data['description'] and len(data['description'].split()) < 100: - errors["description"] = "Description must be at least 100 words." + errors["description"] = f"Description must be at least 100 words. Current count is {len(data['description'].split())}." # Validate the selected plots if 'plots' in data.keys(): diff --git a/archive_api/tests/test_api.py b/archive_api/tests/test_api.py index 46b151f0..ddfb6b8c 100644 --- a/archive_api/tests/test_api.py +++ b/archive_api/tests/test_api.py @@ -330,7 +330,7 @@ def test_user_workflow(self): value = json.loads(response.content.decode('utf-8')) self.assertEqual(status.HTTP_400_BAD_REQUEST, response.status_code) self.assertEqual( - {'description': ['Description must be at least 100 words.'], + {'description': ['Description must be at least 100 words. Current count is 37.'], 'missingRequiredFields': ['archive', 'authors', 'funding_organizations', 'originating_institution', 'qaqc_method_description']}, value) @@ -387,7 +387,7 @@ def test_admin_approve_workflow(self): response = self.client.get("/api/v1/datasets/1/submit/") # In draft mode, owned by auser value = json.loads(response.content.decode('utf-8')) self.assertEqual( - {'description': ['Description must be at least 100 words.'], + {'description': ['Description must be at least 100 words. Current count is 37.'], 'missingRequiredFields': ['archive', 'authors', 'funding_organizations', 'originating_institution', 'qaqc_method_description']}, value) diff --git a/pyproject.toml b/pyproject.toml index d085a11f..ca70a69e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,8 +16,8 @@ description = "NGEE Tropics Archive Service" urls = {Homepage = "https://github.com/NGEET/ngt-archive"} requires-python = '>=3.9,<3.11' dependencies = [ - "Django >= 4.1.1", - "djangorestframework >= 3.11.0", + "Django >= 4.1.1,Django<=4.2.5", + "djangorestframework >= 3.11.0,djangorestframework<=3.14.0", "django-filter", "pyldap>=3.0.0", "django-auth-ldap>=2.1.1",