From 36c61d49ffffc85ccff9eae73358e0da95cb9486 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 6 Jul 2023 11:39:37 +0200 Subject: [PATCH] get manuals first step --- .../modules/did/templates/anonymous.html | 3 +++ ereuse_devicehub/modules/did/views.py | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ereuse_devicehub/modules/did/templates/anonymous.html b/ereuse_devicehub/modules/did/templates/anonymous.html index b2efdadc..9eeb5898 100644 --- a/ereuse_devicehub/modules/did/templates/anonymous.html +++ b/ereuse_devicehub/modules/did/templates/anonymous.html @@ -65,6 +65,9 @@
+ {% for m in manuals.ifixit %} + {{ m }}
+ {% endfor %}
diff --git a/ereuse_devicehub/modules/did/views.py b/ereuse_devicehub/modules/did/views.py index 42223b89..66be1e0d 100644 --- a/ereuse_devicehub/modules/did/views.py +++ b/ereuse_devicehub/modules/did/views.py @@ -40,6 +40,7 @@ class DidView(View): self.get_device() self.get_last_dpp() self.get_before_dpp() + self.get_manuals() if self.accept_json(): return jsonify(self.get_result()) @@ -185,14 +186,19 @@ class DidView(View): return {'data': dpps} def get_manuals(self): - self.params = "{} {}".format(self.device.manufacturer, self.model) + params = { + "manufacturer": 'HP' or self.device.manufacturer, + "model": self.device.model, + } + self.params = json.dumps(params) manuals = {'ifixit': {}, 'icecat': {}} manuals['ifixit'] = self.request_manuals('ifixit') manuals['icecat'] = self.request_manuals('icecat') - return manuals + # import pdb; pdb.set_trace() + self.context['manuals'] = manuals def request_manuals(self, prefix): - url = app.config('URL_MANUALS') + url = app.config['URL_MANUALS'] if not url: return {}