-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LTD: Imrove validation during submission #2337
Open
saruniitr
wants to merge
19
commits into
dev
Choose a base branch
from
LTD-improve-validation-during-submission
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
6bee13f
Add basic validator to validate an application for submission
saruniitr c3714dd
Update validator to validate end-user details
saruniitr c7b6edb
Add locations validator for SIEL applications
saruniitr b7d915f
Add validator to check if security approvals are completed or not
saruniitr 52c7fbd
Merge branch 'dev' into LTD-improve-validation-during-submission
saruniitr 4bcafc1
Add goods and other validators for SIEL applications
saruniitr 6609026
Refactor StandardApplication validators functions
saruniitr 1539921
Fix linter error and raise not implemented error if no validators are…
saruniitr 889222b
Merge branch 'dev' into LTD-improve-validation-during-submission
saruniitr a229adb
Delete unused validation helper functions
saruniitr e7f3dc6
Update test data
saruniitr 2417bf7
Merge branch 'dev' into LTD-improve-validation-during-submission
saruniitr e71affa
Add/update tests to fix coverage issues
saruniitr 7191da4
Merge branch 'dev' into LTD-improve-validation-during-submission
saruniitr acc05f5
Merge branch 'dev' into LTD-improve-validation-during-submission
saruniitr ed49b60
Merge branch 'dev' into LTD-improve-validation-during-submission
saruniitr b768b39
Move the import into the class to avoid circular imports
saruniitr cee13c6
Correct an error message
saruniitr 83f21be
Fix sorting issue
saruniitr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -268,12 +268,17 @@ def set_appealed(self, appeal, exporter_user): | |
self.set_sub_status(CaseSubStatusIdEnum.UNDER_APPEAL__APPEAL_RECEIVED) | ||
self.add_to_queue(Queue.objects.get(id=QueuesEnum.LU_APPEALS)) | ||
|
||
def validate(self): | ||
raise NotImplementedError("Validator to validate application attributes is not implemented") | ||
|
||
def create_amendment(self, user): | ||
raise NotImplementedError() | ||
|
||
|
||
# Licence Applications | ||
class StandardApplication(BaseApplication, Clonable): | ||
from api.applications.validators import StandardApplicationValidator | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this import need to be here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually added this to avoid circular dependencies but they are not there atm, I will move this outside of this. |
||
|
||
GB = "GB" | ||
NI = "NI" | ||
GOODS_STARTING_POINT_CHOICES = [ | ||
|
@@ -289,6 +294,7 @@ class StandardApplication(BaseApplication, Clonable): | |
(VIA_CONSIGNEE, "To an end-user via a consignee"), | ||
(VIA_CONSIGNEE_AND_THIRD_PARTIES, "To an end-user via a consignee, with additional third parties"), | ||
] | ||
validator_class = StandardApplicationValidator | ||
|
||
export_type = models.TextField(choices=ApplicationExportType.choices, blank=True, default="") | ||
reference_number_on_information_form = models.CharField(blank=True, null=True, max_length=255) | ||
|
@@ -422,6 +428,10 @@ def create_amendment(self, user): | |
self.case_ptr.change_status(system_user, get_case_status_by_status(CaseStatusEnum.SUPERSEDED_BY_EXPORTER_EDIT)) | ||
return amendment_application | ||
|
||
def validate(self): | ||
validator = self.validator_class(self) | ||
return validator.validate() | ||
|
||
|
||
class ApplicationDocument(Document, Clonable): | ||
application = models.ForeignKey(BaseApplication, on_delete=models.CASCADE) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice