Skip to content

Conversation

pheus
Copy link
Contributor

@pheus pheus commented Oct 8, 2025

Fixes: #20527

This PR removes the warnings reported in #20527 by updating form fields, GraphQL resolvers, table accessors, and PostgreSQL aggregates to their current, forward‑compatible APIs. It also consolidates a GraphQL import path for clarity.

None of the changes alter user‑visible behavior; they silence deprecations and improve typing so we’re ready for Django 6.0, Strawberry ≥1.0, and django‑tables2 v3.


What’s changed

Forms (URLField default scheme)

  • Contact import & model forms: Opt into the HTTPS default by adding assume_scheme='https' to:
    • ContactImportForm.link
    • ContactForm.link
  • Rationale: Django 6.0 changes the default URL scheme to HTTPS. Passing assume_scheme='https' silences RemovedInDjango60Warning during form construction.

Optional backstop (not included in this PR): set FORMS_URLFIELD_ASSUME_HTTPS = True in settings to adopt the future default globally during the Django 5.x window.

GraphQL (Strawberry)

  • Annotate reserved args: Replace untyped info parameters with info: Info across GraphQL mixins and types to remove the

    “argument name‑based matching of info is deprecated”
    warning and align with Strawberry’s typing rules.

  • Directive typing: Where a filter method uses a prefix directive, annotate as prefix: DirectiveValue[str] for correctness.
  • Import path tidy‑up: Consolidate the import for ObjectChangeType under core.graphql.types to keep type hints consistent.

Tables (django-tables2)

  • Accessor separator: Update DeviceTable to use device_type__u_height instead of device_type.u_height to comply with django_tables2’s __ accessor convention and remove the deprecation.

Querysets (PostgreSQL aggregates)

  • Kwarg rename: Replace deprecated ordering= with order_by= on EmptyGroupByJSONBAgg(...) to match Django 5.2+.

pheus added 6 commits October 8, 2025 16:42
Updates the accessor for the `u_height` column from
`device_type.u_height` to `device_type__u_height` for data retrieval in
device tables (django-tables2 deprecation).
Update EmptyGroupByJSONBAgg('data', order_by=['weight', 'name']) to
follow Django 5.2 deprecation of the ordering kwarg on PostgreSQL
aggregates.
Consolidates the import for `ObjectChangeType` under
`core.graphql.types`. Ensures consistency in type hinting and prevents
potential import errors.
Replaces generic `info` parameters with explicitly typed `info: Info`
across multiple GraphQL mixins. Ensures better type safety and
consistency with Strawberry's typing standards.
This removes the "argument name‑based matching of 'info' is deprecated"
warning and future‑proofs for Strawberry 1.0.
Replaces `prefix: str` with `prefix: DirectiveValue[str]` in GraphQL
filter methods. Ensures compatibility with Strawberry's directive typing
and improves type safety.
Adopt Django 6.0’s future default by adding `assume_scheme='https'`
to `ContactImportForm.link` and `ContactForm.link`. This silences the
URLField deprecation raised at import time when constructing form
fields from model URLFields.
@jeremystretch jeremystretch requested review from a team and jnovinger and removed request for a team October 8, 2025 16:02
@jnovinger jnovinger merged commit f383067 into netbox-community:main Oct 9, 2025
7 checks passed
@pheus pheus deleted the 20527-address-deprecation-warnings branch October 9, 2025 07:27
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.

Address deprecation warnings

2 participants