Skip to content

Fails to fetch model instances when model is restricted to primary keys of a related model. #13

@matthewcove-code

Description

@matthewcove-code

Models related by a Fk to another model are failing to fetch records on the first run. For example where a 'student' has a FK to a 'class', the class is being fetched first but then none of the 'student' records are fetched. Debugging shows that even when we have just fetched all 'class' records, when we process the strategy for the 'student' model and we run 'get_exported_pks_for_model' for the 'class' related model, no primary keys are returned and so the 'studend' queryset returned by get_queryset contains no records.

Removing the '@functools.lru_cache' decorator from 'get_exported_pks_for_model' and 'get_exported_objects_for_model 'fixes the issue.

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