From: Ciro Scognamiglio Date: Mon, 3 Mar 2014 15:59:50 +0000 (+0100) Subject: fixed bug with element id inclusion in the table template X-Git-Tag: myslice-1.1~250 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=14d1e7e1598ebea3cc8d3c9dbf95d034e44d8097;p=myslice.git fixed bug with element id inclusion in the table template --- 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 %}