Skip to content

Commit ca4df06

Browse files
author
Marcin Sołek
committed
Merge branch 'bugfix/playbook-view'
2 parents 7c93370 + 7288348 commit ca4df06

File tree

7 files changed

+21
-17
lines changed

7 files changed

+21
-17
lines changed

RELEASE-NOTES.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### v1.26.1
2+
3+
##### Bugfixes
4+
- Bugfix playbook view ([#321](https://github.com/Code-Poets/project-liberation/pull/321))
5+
6+
17
### v1.26.0
28

39
##### Features

common/helpers.py

-5
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,3 @@ def create_image(
3333
if return_relative_path:
3434
return os.path.join(tmp_dir, file_name)
3535
return file_path
36-
37-
38-
def read_file(path: str) -> bytes:
39-
with open(path, "rb") as file:
40-
return file.read()

company_website/urls.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
url(r"^how-we-work/$", views.HowWeWorkView.as_view(), name="how_we_work"),
1212
url(r"^privacy-and-policy/$", views.PrivacyAndPolicyView.as_view(), name="privacy_and_policy"),
1313
url(r"^thank-you/$", views.ThankYouView.as_view(), name="thank_you"),
14-
url(r"^CodePoetsPlaybook/$", views.display_playbook_view, name="display_playbook"),
14+
url(r"^CodePoetsPlaybook/$", views.PlaybookView.as_view(), name="display_playbook"),
1515
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

company_website/views.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from django.urls import reverse_lazy
99
from django.views.generic import FormView
1010
from django.views.generic import ListView
11+
from django.views.generic import View
1112

12-
from common.helpers import read_file
1313
from company_website.constants import ESTIMATE_PROJECT_EMAIL_SUBJECT
1414
from company_website.constants import ESTIMATE_PROJECT_EMAIL_TEMPLATE_NAME
1515
from company_website.constants import PageNames
@@ -102,14 +102,17 @@ class ThankYouView(CustomTemplateView):
102102
page_name = PageNames.THANK_YOU.name
103103

104104

105-
def display_playbook_view(request: HttpRequest) -> HttpResponse:
106-
playbook_file_name = "CodePoetsPlaybook.pdf"
107-
playbook_path = os.path.join(settings.STATIC_ROOT, "how_we_work", "files", playbook_file_name)
108-
109-
if request.method == "GET":
105+
class PlaybookView(View):
106+
def get(self, _request: HttpRequest) -> HttpResponse:
107+
playbook_file_name = "CodePoetsPlaybook.pdf"
108+
playbook_path = os.path.join(settings.STATIC_ROOT, "how_we_work", "files", playbook_file_name)
110109
if os.path.isfile(playbook_path):
111-
response = HttpResponse(read_file(playbook_path), content_type="application/pdf")
110+
response = HttpResponse(self.read_file(playbook_path), content_type="application/pdf")
112111
response["Content-Disposition"] = f"filename={playbook_file_name}"
113112
return response
114113
return HttpResponse(status=404)
115-
return HttpResponse(status=405)
114+
115+
@staticmethod
116+
def read_file(path: str) -> bytes:
117+
with open(path, "rb") as file:
118+
return file.read()

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "project-liberation",
3-
"version": "v1.26.0",
3+
"version": "v1.26.1",
44
"description": "Packages needed for proper application work.",
55
"main": "index.js",
66
"scripts": {

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "project-liberation"
3-
version = "v1.26.0"
3+
version = "v1.26.1"
44
description = "Necessary packages for Project Liberation"
55
authors = ["Karol Beker <[email protected]>"]
66

0 commit comments

Comments
 (0)