Skip to content
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

Fixed repeated validation errors when duplicate entries are detected #530

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ghostwriter/rolodex/forms_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def clean(self):
code="duplicate",
),
)
duplicates = False
# Check that all objective have a deadline and status
if deadline and not objective:
form.add_error(
Expand Down Expand Up @@ -182,6 +183,7 @@ def clean(self):
code="duplicate",
),
)
duplicates = False

# Raise an error if an operator is selected provided without any required details
if operator and any(x is None for x in [start_date, end_date, role]):
Expand Down Expand Up @@ -280,6 +282,7 @@ def clean(self):
code="duplicate",
),
)
duplicates = False
if name or description:
if not scope:
form.add_error(
Expand Down
5 changes: 4 additions & 1 deletion ghostwriter/shepherd/forms_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def clean(self):
code="duplicate",
),
)
duplicates = False

# Check that only one address is marked as the primary
if primary and ip_address:
Expand Down Expand Up @@ -253,7 +254,9 @@ def __init__(self, *args, **kwargs):
<h4 class="icon custom-field-icon">Extra Fields</h4>
<hr />
"""
) if has_extra_fields else None,
)
if has_extra_fields
else None,
"extra_fields" if has_extra_fields else None,
link_css_class="icon server-icon",
css_id="server",
Expand Down