Skip to content

Commit

Permalink
Merge pull request #2722 from uktrade/make-enquiries-contact-required…
Browse files Browse the repository at this point in the history
…-field

Make enquiries contact required field for catalogue items
  • Loading branch information
tayyib-saddique authored Aug 15, 2023
2 parents 3e8bec3 + ef5b470 commit 4287160
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 8 deletions.
5 changes: 5 additions & 0 deletions dataworkspace/dataworkspace/apps/dw_admin/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def __init__(self, *args, **kwargs):
self.fields["information_asset_owner"].required = True
if "information_asset_manager" in self.fields:
self.fields["information_asset_manager"].required = True
if "enquiries_contact" in self.fields:
self.fields["enquiries_contact"].required = True
if "sort_field" in self.fields:
self.fields["sort_field"].queryset = self.instance.fields.all()

Expand Down Expand Up @@ -531,6 +533,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["information_asset_owner"].required = True
self.fields["information_asset_manager"].required = True
self.fields["enquiries_contact"].required = True

class Meta:
model = MasterDataset
Expand All @@ -545,6 +548,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["information_asset_owner"].required = True
self.fields["information_asset_manager"].required = True
self.fields["enquiries_contact"].required = True

class Meta:
model = MasterDataset
Expand Down Expand Up @@ -718,6 +722,7 @@ def __init__(self, *args, **kwargs):

self.fields["information_asset_owner"].required = True
self.fields["information_asset_manager"].required = True
self.fields["enquiries_contact"].required = True


class VisualisationLinkForm(forms.ModelForm):
Expand Down
1 change: 1 addition & 0 deletions dataworkspace/dataworkspace/tests/datasets/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4795,6 +4795,7 @@ def test_csv_upload(
published=True,
user_access_type=UserAccessType.REQUIRES_AUTHENTICATION,
information_asset_manager=user,
enquiries_contact=user,
),
schema="test",
table="table1",
Expand Down
1 change: 1 addition & 0 deletions dataworkspace/dataworkspace/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class DataSetFactory(factory.django.DjangoModelFactory):
type = DataSetType.DATACUT
information_asset_owner = factory.SubFactory(UserFactory)
information_asset_manager = factory.SubFactory(UserFactory)
enquiries_contact = factory.SubFactory(UserFactory)

class Meta:
model = "datasets.DataSet"
Expand Down
Loading

0 comments on commit 4287160

Please sign in to comment.