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

DST-950: initial trio of views #186

Open
wants to merge 19 commits into
base: save-and-return
Choose a base branch
from
Open

Conversation

morganmaerees
Copy link
Contributor

@morganmaerees morganmaerees commented Jan 28, 2025

Converting the following views to save and return:

  • Business views
  • Individual views
  • Myself views

Frontend tests are failing due to the CYA pages but this will be addressed in https://uktrade.atlassian.net/browse/DST-952

@morganmaerees morganmaerees marked this pull request as ready for review January 29, 2025 12:33
@morganmaerees morganmaerees requested a review from a team as a code owner January 29, 2025 12:33
Copy link
Collaborator

@chris-pettinga chris-pettinga left a comment

Choose a reason for hiding this comment

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

Great start thank you. Left some comments

django_app/apply_for_a_licence/forms/forms_business.py Outdated Show resolved Hide resolved
django_app/apply_for_a_licence/forms/forms_business.py Outdated Show resolved Hide resolved
django_app/apply_for_a_licence/forms/forms_business.py Outdated Show resolved Hide resolved
Comment on lines 137 to 138
licence_id = self.request.session["licence_id"]
licence_object = Licence.objects.get(pk=licence_id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this logic I think is shared between a bunch of views and could potentially be abstracted to a get_object() method as part of a DetailView because that's kind of what we're doing. It will also allow us a single place these objects are retrieved which means we can easily put security controls in place to make sure you only see the Licence objects that you have access to

Comment on lines 28 to 30
individual_id = self.kwargs.get("individual_uuid")
licence_id = self.request.session["licence_id"]
licence_object = get_object_or_404(Licence, pk=licence_id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah I think most of these views are really actually DetailViews, what do you think?

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