Skip to content

Commit

Permalink
[WEB-2631] chore: changed the cascading logic for soft delete (#5829)
Browse files Browse the repository at this point in the history
* chore: changed the cascading logic for soft delete

* chore: changed the delete key

* chore: added the key on delete in project base model
  • Loading branch information
NarayanBavisetti authored Oct 15, 2024
1 parent 662b99d commit 3d7d3c8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apiserver/plane/app/views/workspace/draft.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def create_draft_to_issue(self, request, slug, draft_id):
{
"updated_cycle_issues": None,
"created_cycle_issues": serializers.serialize(
"json", created_records
"json", [created_records]
),
}
),
Expand Down
4 changes: 2 additions & 2 deletions apiserver/plane/bgtasks/deletion_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def soft_delete_related_objects(
try:
# Check if the field has CASCADE on delete
if (
hasattr(field.remote_field, "on_delete")
and field.remote_field.on_delete == models.CASCADE
not hasattr(field.remote_field, "on_delete")
or field.remote_field.on_delete == models.CASCADE
):
if field.one_to_many:
related_objects = getattr(instance, field.name).all()
Expand Down
2 changes: 1 addition & 1 deletion apiserver/plane/db/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class ProjectBaseModel(BaseModel):
Project, on_delete=models.CASCADE, related_name="project_%(class)s"
)
workspace = models.ForeignKey(
"db.Workspace", models.CASCADE, related_name="workspace_%(class)s"
"db.Workspace", on_delete=models.CASCADE, related_name="workspace_%(class)s"
)

class Meta:
Expand Down

0 comments on commit 3d7d3c8

Please sign in to comment.