-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: save-and-return
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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
licence_id = self.request.session["licence_id"] | ||
licence_object = Licence.objects.get(pk=licence_id) |
There was a problem hiding this comment.
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
individual_id = self.kwargs.get("individual_uuid") | ||
licence_id = self.request.session["licence_id"] | ||
licence_object = get_object_or_404(Licence, pk=licence_id) |
There was a problem hiding this comment.
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?
Converting the following views to save and return:
Frontend tests are failing due to the CYA pages but this will be addressed in https://uktrade.atlassian.net/browse/DST-952