diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-06-08 11:12:47 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-12 00:01:48 +0100 |
commit | 7c2b86625b75f0c3c5447d240175558be1e37919 (patch) | |
tree | 103e2efd1fdb6de3c198ff475fe9380302e2d6eb /bitbake/lib/toaster/toastergui/tables.py | |
parent | 51ae1de5b75b6f831b46433b2e36c6112d1a0c59 (diff) | |
download | poky-7c2b86625b75f0c3c5447d240175558be1e37919.tar.gz |
bitbake: toaster: add class template view for single-object pages
Adding ToasterTemplateView as prototype for all class-based
views that display single objects; equivalent to ToasterTable
for object lists.
(Bitbake rev: d3edea773000a663f5883e04f477d853bff64cf6)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/tables.py')
-rw-r--r-- | bitbake/lib/toaster/toastergui/tables.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py index e540b91499..e03aa768c9 100644 --- a/bitbake/lib/toaster/toastergui/tables.py +++ b/bitbake/lib/toaster/toastergui/tables.py | |||
@@ -19,7 +19,7 @@ | |||
19 | # with this program; if not, write to the Free Software Foundation, Inc., | 19 | # with this program; if not, write to the Free Software Foundation, Inc., |
20 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 20 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
21 | 21 | ||
22 | from toastergui.widgets import ToasterTable | 22 | from toastergui.widgets import ToasterTable, ToasterTemplateView |
23 | from orm.models import Recipe, ProjectLayer, Layer_Version, Machine, Project | 23 | from orm.models import Recipe, ProjectLayer, Layer_Version, Machine, Project |
24 | from django.db.models import Q, Max | 24 | from django.db.models import Q, Max |
25 | from django.conf.urls import url | 25 | from django.conf.urls import url |
@@ -142,16 +142,24 @@ class LayersTable(ToasterTable): | |||
142 | static_data_name="add-del-layers", | 142 | static_data_name="add-del-layers", |
143 | static_data_template='{% include "layer_btn.html" %}') | 143 | static_data_template='{% include "layer_btn.html" %}') |
144 | 144 | ||
145 | class LayerDetails(TemplateView): | 145 | |
146 | |||
147 | class LayerDetails(ToasterTemplateView): | ||
146 | def get_context_data(self, **kwargs): | 148 | def get_context_data(self, **kwargs): |
147 | context = super(LayerDetails, self).get_context_data(**kwargs) | 149 | context = super(LayerDetails, self).get_context_data(**kwargs) |
150 | from toastergui.views import _lv_to_dict | ||
148 | 151 | ||
149 | context['project'] = Project.objects.get(pk=kwargs['pid']) | 152 | context['project'] = Project.objects.get(pk=kwargs['pid']) |
150 | context['layerversion'] = Layer_Version.objects.get(pk=kwargs['layerid']) | 153 | context['layerversion'] = Layer_Version.objects.get(pk=kwargs['layerid']) |
154 | context['layerdict'] = _lv_to_dict(context['project'], context['layerversion']) | ||
155 | context['layerdeps'] = {"list": [x.depends_on.get_equivalents_wpriority(context['project'])[0] for x in context['layerversion'].dependencies.all()]} | ||
151 | context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project'])) | 156 | context['projectlayers'] = map(lambda prjlayer: prjlayer.layercommit.id, ProjectLayer.objects.filter(project=context['project'])) |
152 | 157 | ||
158 | self.context_entries = ['project', 'layerversion', 'projectlayers', 'layerdict', 'layerdeps'] | ||
159 | |||
153 | return context | 160 | return context |
154 | 161 | ||
162 | |||
155 | class MachinesTable(ToasterTable): | 163 | class MachinesTable(ToasterTable): |
156 | """Table of Machines in Toaster""" | 164 | """Table of Machines in Toaster""" |
157 | 165 | ||