get manuals first step
This commit is contained in:
parent
2f9a2edb44
commit
36c61d49ff
|
@ -65,6 +65,9 @@
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
{% for m in manuals.ifixit %}
|
||||||
|
{{ m }}<br />
|
||||||
|
{% endfor %}
|
||||||
<h3 class="nav-link mt-5" style="color: #993365">{{ device_real.type }} - {{ device_real.verbose_name }}</h3>
|
<h3 class="nav-link mt-5" style="color: #993365">{{ device_real.type }} - {{ device_real.verbose_name }}</h3>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
|
|
@ -40,6 +40,7 @@ class DidView(View):
|
||||||
self.get_device()
|
self.get_device()
|
||||||
self.get_last_dpp()
|
self.get_last_dpp()
|
||||||
self.get_before_dpp()
|
self.get_before_dpp()
|
||||||
|
self.get_manuals()
|
||||||
|
|
||||||
if self.accept_json():
|
if self.accept_json():
|
||||||
return jsonify(self.get_result())
|
return jsonify(self.get_result())
|
||||||
|
@ -185,14 +186,19 @@ class DidView(View):
|
||||||
return {'data': dpps}
|
return {'data': dpps}
|
||||||
|
|
||||||
def get_manuals(self):
|
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': {}, 'icecat': {}}
|
||||||
manuals['ifixit'] = self.request_manuals('ifixit')
|
manuals['ifixit'] = self.request_manuals('ifixit')
|
||||||
manuals['icecat'] = self.request_manuals('icecat')
|
manuals['icecat'] = self.request_manuals('icecat')
|
||||||
return manuals
|
# import pdb; pdb.set_trace()
|
||||||
|
self.context['manuals'] = manuals
|
||||||
|
|
||||||
def request_manuals(self, prefix):
|
def request_manuals(self, prefix):
|
||||||
url = app.config('URL_MANUALS')
|
url = app.config['URL_MANUALS']
|
||||||
if not url:
|
if not url:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
Reference in New Issue