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

Add description field to TrainingItems #523

Merged
merged 9 commits into from
Feb 22, 2023

Conversation

FreneticScribbler
Copy link
Member

Also adds the ability to export the training item list to a PDF. WIP.

@jerbzz
Copy link
Contributor

jerbzz commented Feb 20, 2023

Nice 👌🏻

@FreneticScribbler FreneticScribbler marked this pull request as ready for review February 21, 2023 10:55
Copy link

@code-review-doctor code-review-doctor bot 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. Worth considering though. View full project report here.

PyRIGS/views.py Outdated
object_name = re.sub(r'[^a-zA-Z0-9 \n\.]', '', obj.name)

context = {
'object': obj,
'current_user': self.request.user,
'object_name': object_name,
'info_string': f"[Paperwork generated {user_str}on {time} - {obj.current_version_id}]",
'info_string': get_info_string(self.request.user) + "- {obj.current_version_id}]",

Choose a reason for hiding this comment

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

Suggested change
'info_string': get_info_string(self.request.user) + "- {obj.current_version_id}]",
'info_string': get_info_string(self.request.user) + f"- {obj.current_version_id}]",

If this was meant to be f-string then f prefix is missing. More info.

PyRIGS/views.py Outdated
class PrintListView(generic.ListView):
def get_context_data(self, *args, **kwargs):
context = super().get_context_data(*args, **kwargs)
context['current_user'] = self.request.user,

Choose a reason for hiding this comment

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

Suggested change
context['current_user'] = self.request.user,
context['current_user'] = self.request.user

It looks like None should not be a tuple? The comma after the value makes it a tuple. Explained here.


def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['filename'] = f"TrainingItemList.pdf"

Choose a reason for hiding this comment

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

Suggested change
context['filename'] = f"TrainingItemList.pdf"
context['filename'] = "TrainingItemList.pdf"

f-string is unnecessary here. This can just be a string. Read more.

@FreneticScribbler FreneticScribbler temporarily deployed to pyrigs-pipel-trainingit-gfjxeq February 22, 2023 09:59 Inactive
@FreneticScribbler FreneticScribbler temporarily deployed to pyrigs-pipel-trainingit-gfjxeq February 22, 2023 09:59 Inactive
@FreneticScribbler FreneticScribbler temporarily deployed to pyrigs-pipel-trainingit-gfjxeq February 22, 2023 13:17 Inactive
@FreneticScribbler FreneticScribbler merged commit 8863d86 into master Feb 22, 2023
@FreneticScribbler FreneticScribbler deleted the trainingitem-description branch February 22, 2023 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants