fixed bug with element id inclusion in the table template
authorCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Mon, 3 Mar 2014 15:59:50 +0000 (16:59 +0100)
committerCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Mon, 3 Mar 2014 15:59:50 +0000 (16:59 +0100)
rest/__init__.py
rest/templates/table-default.html

index 2638b8e..39235b0 100644 (file)
@@ -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)
     
index 71ae083..18a943f 100644 (file)
@@ -8,7 +8,7 @@
 <tbody>
 {% for d in data %}
 <tr id="{{ d|key:id }}">
-       {% if "checkbox" in options %}<td><input type="checkbox" name="{{ id }}" value="{{ d|key:id }}" /></td>{% endif %}
+       {% if "checkbox" in options %}<td class="checkbox"><input type="checkbox" name="{{ id }}" value="{{ d|key:id }}" /></td>{% endif %}
        {% for f in fields %}<td><div class="line1">{{ d|key:f }}</div></td>{% endfor %}
 </tr>
 {% endfor %}