Serializers used only in a nested context have no complete form in the schema, so
prefixing them with "Brief" renamed an existing component to no purpose and dropped
the old name entirely. Exempt serializers declaring an explicit Meta.ref_name from
the prefix, and pin the three affected names.
This narrows the schema diff to the fields the bug actually affected: no components
are removed, and the nine which are added are purely additive.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* Drop the non-BaseModelSerializer fallback in FixSerializedPKRelatedField.
SerializedPKRelatedField.to_representation() passes nested unconditionally, so a
serializer which doesn't accept it raises TypeError on every read; the branch
documented a component for a configuration the API cannot serve.
* Generate the OpenAPI schema once per class rather than once per test method.
* Exercise the component.ref and request-schema return paths, and use SimpleTestCase
for the tests which don't touch the database.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
FixSerializedPKRelatedField passed the serializer class to resolve_serializer(),
which instantiates it with no arguments. The field's nested setting was therefore
lost, and the generated response schema referenced the complete component (with
the complete field set) even where the field renders a brief representation.
Resolve an instance carrying the field's nested setting instead. Request schemas
are unaffected and continue to accept integer primary keys.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Teach _get_nested_serializer() to unwrap ManyRelatedField and resolve the
serializer configured on SerializedPKRelatedField. Preserve the field's
nested value so prefetch discovery follows brief_fields for nested
representations and the full field set otherwise.
Guard the recursion against reference cycles by tracking the serializer
states already being resolved on the current path. Because nested defaults
to False the target expands its full field set, so a self-referential or
mutually referential declaration would otherwise recurse without a
termination condition. The key pairs the serializer class with its
effective field set, since re-entering a serializer at a narrower depth is
finite rather than cyclic, and the states are copied per frame so a sibling
field can still expand what another one stops at.
Populate interface VDC relationships and VRF route target assignments in
the API test fixtures, update the two query count baselines, and add
coverage for direct, many-valued and non-nested serialized related fields
alongside self-referential, mutually referential, brief-depth and
sibling-reuse cases.
Fixes#22988
SideNav classified the viewport only during construction. Resizing past
the `lg` breakpoint therefore left the desktop sidebar in its previous
mobile state, and the menu group containing the current page remained
collapsed until the pointer entered the sidebar.
Use the existing desktop media query as an event source. Apply the
persisted pin preference directly to the body attributes during
initialization and on each breakpoint transition, then reinitialize the
active menu section.
Avoid calling `pin()` or `unpin()` during responsive transitions so
Bootstrap retains ownership of its collapse state and the stored
preference is not rewritten unnecessarily.
Also remove the `show` class from a menu group toggle when collapsing
its section to keep the toggle and menu state synchronized.
Fixes#23035
Move owner field from fieldsets to Meta.fields in PowerOutletForm and
add it to ServiceCreateForm Meta.fields. Ensures owner field appears in
forms and can be properly saved. Adds test coverage with Owner creation.
Fixes#23052
Replace NumberFilter with MultiValueNumberFilter for VLANGroup scope
filters (Region, Site Group, Site, Location, Rack Group, Rack,
Cluster Group, Cluster). Update filter_scope method to use `__in`
lookup and add comprehensive test coverage for multi-value filtering.
Fixes#22671
Render social authentication actions as POST forms to comply with
social-auth-app-django 6.0's POST-only begin view. Pass the `next` and
SAML `idp` parameters as hidden fields so they remain available to
`do_auth()`.
Preserve the post-login URL when the login page is re-rendered after a
failed password attempt, and avoid shadowing the request data while
enumerating SAML identity providers. Extend the tests to validate the
rendered SSO forms and their hidden parameters.
Storage backends such as S3 may return presigned URLs whose signature covers
the entire query string. Appending a version parameter to such a URL after it
has been signed invalidates the signature, causing the storage backend to
reject the request with a 403.
Return signed URLs unmodified. These embed an expiration and are regenerated
on each request, so they require no cache-busting parameter.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Reopens any issue that is closed as completed without a milestone
assigned, after a short grace period to allow for the milestone being
set immediately after closure.
Adds parent field to InterfaceTemplateImportForm to support channelized
interface imports. Filters parent queryset by device_type or module_type
during validation to prevent MultipleObjectsReturned errors when
resolving parent interfaces by name.
Fixes#23036
Store the vertical sidebar's scroll position in session storage so it
remains scoped to the current browser tab. Restore it on the next page
and use the browser's native scrolling behavior to reveal the active
item when needed.
When the active dropdown is closed, reveal its top-level heading instead
of the hidden child. Persist only positive offsets from an overflowing
sidebar so a collapsed or non-scrollable layout cannot erase a useful
saved position with zero.
Propagate the signal-provided database alias through config context
cache invalidation so scope lookups, cache updates, and commit callbacks
use the same connection and transaction as the triggering change.
Watch Cluster scope changes through `_site_id` and add routing coverage
for direct, nested, tagged, reparented, and upstream invalidation paths.
`nullable_fields` only marks declared form fields as clearable.
Several bulk edit forms referenced missing, stale, duplicate, or
non-model fields. This left intended fields unavailable, rendered
ineffective Set Null controls, and could trigger a server error for
Contact bulk edits.
Declare the intended fields, correct the PowerFeed and DataSource
entries, and remove invalid Contact group fields. Align owner and
comments nullification on forms that do not inherit the common
bulk-edit fields, and prevent DataSource comments from rendering twice.
Add regression coverage to keep nullable declarations aligned with
their form and model fields.
Fixes#22990
CableType.a_terminations and b_terminations were declared as bare
annotations, so strawberry-django resolved them by reading the model
properties with no prefetch hint. That left two nested N+1s (one query
per Cable for terminations, one per CableTermination for the termination
GFK) plus the termination's own device FK chain, for roughly six queries
per termination.
Resolve both fields via resolvers carrying a Prefetch of the
terminations for that cable end, with the termination GFK prefetched
through the existing build_gfk_prefetch() helper so the nested joins are
derived from the client's selection set rather than hard-coded.
Each end is prefetched under its own to_attr: two prefetches of the same
relation cannot be merged by the query optimizer, so a shared lookup
would break any query selecting both ends.
Replace hardcoded width check with Bootstrap's lg breakpoint (992px)
using matchMedia API. Adds constant with comment linking to navbar
configuration for maintainability.
Remove Bootstrap Collapse instances and section link handling logic that
is no longer needed. Simplifies sidebar navigation by removing manual
collapse management and related event handlers.
Fixes#22931
The REST API's write paths are transactional, but the in-memory events queue
is not: change logging receivers queue events eagerly (for deletions in
pre_delete, before the row is removed), and event_tracking() flushes that queue
only after the response has been rendered. Where a rolled-back write is caught
and converted into a normal response — the ProtectedError/RestrictedError and
AbortRequest handlers in NetBoxModelViewSet.dispatch(), and the
ObjectDoesNotExist to PermissionDenied conversions in the perform_*() methods —
the flush therefore dispatched events for objects that were never created,
updated, or deleted.
Backport discard_events_on_rollback() from the feature branch and enter it
inside the transaction guarding each API write: perform_create(),
perform_update(), and perform_destroy(); the SequentialBulkCreatesMixin,
BulkUpdateModelMixin, and BulkDestroyModelMixin bulk actions; and
AvailableObjectsView.post(). The context manager sends clear_events on the way
out whenever the wrapped transaction is rolled back, whether by an exception
escaping the block or by an explicit set_rollback(), which also covers the
exceptions that reach dispatch(). This mirrors what the UI views now do (#22934).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Removes clone_fields declarations from ContactAssignment,
ImageAttachment, and FHRPGroupAssignment models that don't inherit
CloningMixin.
Adds test coverage to prevent clone_fields on models without cloning
support.
Fixes#22987
Add 4X interface choices for all supported InfiniBand generations and
include the lane width in each display label. Correct the existing XDR
1X rate from 250 Gbps to 200 Gbps.
Skip descendant and component denormalization updates when a Location,
Rack, or Device is saved without changing its scope assignments. Handle
partial saves safely to avoid propagating stale in-memory values.
Introduces 100GBASE-X-SFP112 interface type to support SFP112 form
factor transceiver modules. Adds new choice constant and display label
in alphabetical order within 100GE interface types section.
Fixes#22998
Replace redundant conditional blocks with single if-else statement and
move resize listener outside viewport check. Changes width threshold
from `>` to `>=` for consistency with standard breakpoint behavior.
Fixes#22930
Add set_base() support to CustomTaggableManager so Django's
deserializer can restore tag relationships through django-taggit.
Normalize primary-key values before delegating to taggit and add
regression coverage for object- and PK-based inputs.
Declare module_bay_types as a SerializedPKRelatedField on the Module
Bay, Module Bay Template, and Module Type serializers. This accepts
primary keys on write while preserving the nested representation on
read and avoids DRF's writable-nested assertion.
Because automatic serializer prefetch discovery no longer recurses into
this field, add manufacturer prefetches to the corresponding viewsets.
Populate the API test fixtures with Module Bay Types so the existing
list query-count tests cover the relationship and guard against N+1
queries.
Fixes#22982