Skip to content

Conversation

@malcolmbaig
Copy link
Contributor

@malcolmbaig malcolmbaig commented Dec 11, 2025

Description

  • Add delete link to appointment note tab (with confirmation step)
  • Move appointment note views into their own file
Screenshot 2025-12-11 at 12 58 54 Screenshot 2025-12-11 at 13 03 09 Screenshot 2025-12-11 at 13 03 25

Jira link

https://nhsd-jira.digital.nhs.uk/browse/DTOSS-11725

Review notes

na

Review checklist

  • Check database queries are correctly scoped to current_provider

@malcolmbaig malcolmbaig requested a review from a team December 11, 2025 14:20
@malcolmbaig malcolmbaig changed the title 11725 delete note Add link to delete appointment notes Dec 11, 2025
- Put appointment note view logic into its own file
- Add a view dealing with note deletion, including a confirmation step
If a user clicks on a stale delete link for an appointment note that has
already been deleted, simply redirect them back to the note tab.
Copy link
Contributor

@MatMoore MatMoore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍🏻


@property
def instance_is_saved(self):
return self.instance and not self.instance._state.adding
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this be simplified to self.instance.pk is not None?

_state just looks a bit iffy to me as it normally indicates private fields, although it is part of the documented API in this case. OK to leave it as is if you prefer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Started off as that but it looks like Django assigns uuid primary keys at instantiation time so this check wasn't working as intended.


def get_success_url(self):
return reverse("mammograms:appointment_note", kwargs={"pk": self.kwargs["pk"]})

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this logic be moved into the superclass do you think? I've just added something similar for add and update in this PR #824

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean in DeleteWithAuditView? Worth considering — would be interested in seeing what that looks like.

@malcolmbaig malcolmbaig merged commit 8710e0e into main Dec 12, 2025
12 checks passed
@malcolmbaig malcolmbaig deleted the 11725-delete-note branch December 12, 2025 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants