Skip to content

evaluation of field.queryset in __process_field causes database query #68

@rrauenza

Description

@rrauenza

This line causes a database query:

  """                                                                                   
  Generates and returns a tuple representing the Typescript field name and Type.        
  """                                                                                   
  # For PrimaryKeyRelatedField, set field_type to the type of the primary key           
  # on the related model                                                                
  if isinstance(field, serializers.PrimaryKeyRelatedField) and field.queryset:
      is_many = False     

I think what is wanted is

   if isinstance(field, serializers.PrimaryKeyRelatedField) and field.queryset is not None: 

otherwise the queryset is fulfilled to see if it has any results.

I'll do a PR...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions