Skip to content

Commit

Permalink
Added skip/remove signals for which 'Include in signal app' is checke…
Browse files Browse the repository at this point in the history
…d off
  • Loading branch information
dmytrotsko committed Dec 30, 2024
1 parent 99d45b2 commit beb544c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/signals/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,14 @@ def before_import_row(self, row, **kwargs) -> None:
if not row.get("Source Subdivision"):
row["Source Subdivision"] = None

# def skip_row(self, instance, original, row, import_validation_errors=None):
# if not row["Include in signal app"]:
# return True
def skip_row(self, instance, original, row, import_validation_errors=None):
if not row["Include in signal app"]:
try:
signal = Signal.objects.get(name=row["Signal"], source=row["Source Subdivision"])
signal.delete()
except Signal.DoesNotExist:
pass
return True

def after_import_row(self, row, row_result, **kwargs):
try:
Expand Down

0 comments on commit beb544c

Please sign in to comment.