Skip to content

Commit

Permalink
fix lint warnings, import error
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvin-muchiri committed Nov 26, 2024
1 parent b3e97a7 commit 5a3b695
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions onadata/apps/logger/management/commands/restore_form.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.core.management.base import BaseCommand, CommandError

from logger.models import XForm
from onadata.apps.logger.models import XForm


class Command(BaseCommand):
Expand Down Expand Up @@ -42,14 +42,16 @@ def handle(self, *args, **options):
self.stdout.write(
self.style.SUCCESS(
(
f"Successfully restored form '{xform.id_string}' with ID {form_id} "
f"deleted by {was_deleted_by} at {was_deleted_at}."
f"Successfully restored form '{xform.id_string}' with "
f"ID {form_id} deleted by {was_deleted_by} at {was_deleted_at}."
)
)
)

except XForm.DoesNotExist:
raise CommandError(f"Form with ID {form_id} does not exist")

except Exception as e:
raise CommandError(f"An error occurred while restoring the form: {e}")
except Exception as exc:
raise CommandError(
f"An error occurred while restoring the form: {exc}"
) from exc

0 comments on commit 5a3b695

Please sign in to comment.