369 if count_rows is not None:
370 response['count'] = count_rows
371
372 limit = queryset._limit373 if limit:
374 response['limit'] = limit
375
288 }
289
290 def get_model_fields(self, model):
291 fields = model._meta.get_fields()292
293 def filter_fields(x):
294 if any(map(lambda rel: isinstance(x, rel), [
284 if not Model or not hasattr(Model, '_meta'):
285 return
286 return {
287 'model': Model._meta.db_table,288 }
289
290 def get_model_fields(self, model):
223 }
224
225 if hasattr(model._meta, 'ordering') and model._meta.ordering:
226 ordering = model._meta.ordering[0]227 desc = ordering.startswith('-')
228 field_name = ordering[1:] if desc else ordering
229
222 'fields': list(map(lambda field: self.serialize_field(field), fields))
223 }
224
225 if hasattr(model._meta, 'ordering') and model._meta.ordering:226 ordering = model._meta.ordering[0]
227 desc = ordering.startswith('-')
228 field_name = ordering[1:] if desc else ordering
Accessing a protected member (a member prefixed with _
) of a class from outside that class is not recommended, since the creator of that class did not intend this member to be exposed. If accesing this attribute outside of the class is absolutely needed, refactor it such that it becomes part of the public interface of the class.
class Rectangle(object):
def __init__(self, height, width):
self._height = height
self._width = width
r = Rectangle(4, 8)
area = r._height * r._width
class Rectangle(object):
def __init__(self, height, width):
self._height = height
self._width = width
def area():
return self._height * self._width
r = Rectangle(4, 8)
area = r.area()