Why "flat" keyword is accepted that way? Why not just as def 
values_list(self, *fields, flat=False)? Because of that I cannot have 
support in my IDE (autocomplete)

def values_list(self, *fields, **kwargs):
        flat = kwargs.pop('flat', False)
        if kwargs:
            raise TypeError('Unexpected keyword arguments to values_list: %s
' % (list(kwargs),))

        if flat and len(fields) > 1:
           raise TypeError("'flat' is not valid when values_list is called 
with more than one field.")

        _fields = []
        expressions = {}

        for field in fields:
           if hasattr(field, 'resolve_expression'):
               field_id = str(id(field))
               expressions[field_id] = field
               _fields.append(field_id)
           else:
               _fields.append(field)
   
        clone = self._values(*_fields, **expressions)
        clone._iterable_class = FlatValuesListIterable if flat else 
ValuesListIterable
        return clone


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/237365e6-2566-4ef3-b86a-005487afb5b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to