Skip to content

Conversation

@pheus
Copy link
Contributor

@pheus pheus commented Oct 24, 2025

Fixes: #20653

Summary

Fix Jobs list returning empty results when filtering by Object Type by introducing a proper object_type_id filter and exposing it in the Jobs filter form/fieldsets.

Changes

  • Add object_type_id to the Jobs FilterSet.
  • Update the Jobs filter form and fieldsets to include it.
  • No model/schema changes or migrations.

Introduce a new `object_type_id` filter to enhance filtering by object
type for Jobs. Update related forms and fieldsets to incorporate the
new filter for better usability and consistency.

Fixes netbox-community#20653
@pheus pheus marked this pull request as ready for review October 24, 2025 14:08
@jnovinger jnovinger requested review from a team and arthanson and removed request for a team October 24, 2025 14:46
Copy link
Collaborator

@arthanson arthanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work, but I think this is still broken in the REST API - would be good to fix that in this PR. There is an object_type_id in the REST filter but sending the same filter param as in the UI returned 0 results instead of the two that I had in the REST API.

@pheus
Copy link
Contributor Author

pheus commented Oct 24, 2025

Thanks for the thorough review - much appreciated!

I tried to reproduce the REST issue but I’m seeing consistent results between the UI and the API. On my dev instance (301 jobs total), filtering for extras.Script yields 291 matches both ways:

  • UI: Object Type → Extras / Script → 291
  • API:
    1. Get the ContentType ID
      GET /api/extras/object-types/?app_label=extras&model=script → id=2
    2. Use it to filter
      GET /api/core/jobs/?object_type_id=2 → 291
      (Also tried GET /api/core/jobs/?object_type=extras.script with the same result.)

Could you share the exact request you used, the Object Type (e.g. app_label.Model or the ContentType ID)?

I’ll reproduce your case and update the PR accordingly. Thanks again for taking a close look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filtering Jobs by Object Type return empty set

2 participants