From 14d1e7e1598ebea3cc8d3c9dbf95d034e44d8097 Mon Sep 17 00:00:00 2001 From: Ciro Scognamiglio Date: Mon, 3 Mar 2014 16:59:50 +0100 Subject: [PATCH] fixed bug with element id inclusion in the table template --- rest/__init__.py | 11 ++++++----- rest/templates/table-default.html | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/rest/__init__.py b/rest/__init__.py index 2638b8ef..39235b07 100644 --- a/rest/__init__.py +++ b/rest/__init__.py @@ -71,10 +71,6 @@ class ObjectRequest(object): selected_fields.append(p) self.fields = selected_fields - # - if self.id in self.fields : - self.fields.remove(self.id) - [self.id].extend(self.fields) def applyFilters(self, query, force_filters = False): if (force_filters and not self.filters) : @@ -96,7 +92,12 @@ class ObjectRequest(object): return query def get(self): - query = Query.get(self.type).select(self.fields) + query = Query.get(self.type) + if (self.id not in self.fields) : + query.select(self.fields + [self.id]) + else : + query.select(self.fields) + query = self.applyFilters(query) return execute_query(self.request, query) diff --git a/rest/templates/table-default.html b/rest/templates/table-default.html index 71ae0837..18a943f0 100644 --- a/rest/templates/table-default.html +++ b/rest/templates/table-default.html @@ -8,7 +8,7 @@ {% for d in data %} - {% if "checkbox" in options %}{% endif %} + {% if "checkbox" in options %}{% endif %} {% for f in fields %}
{{ d|key:f }}
{% endfor %} {% endfor %} -- 2.47.0