Commit Graph

14334 Commits

Author SHA1 Message Date
Jason Novinger cf5bf9a4d0 Fix import order 2025-10-26 23:21:28 -05:00
Jason Novinger d89948b3ab Remove extraneous TS comments 2025-10-26 23:12:55 -05:00
Jason Novinger af8f460288 Fixes #7604: Add filter modifier dropdowns for advanced lookup operators
Implements dynamic filter modifier UI that allows users to select lookup operators
(exact, contains, starts with, regex, negation, empty/not empty) directly in filter
forms without manual URL parameter editing.

Supports filters for all scalar types and strings, as well as some
related object filters. Explicitly does not support filters on fields
that use APIWidget. That has been broken out in to follow up work.

**Backend:**
- FilterModifierWidget: Wraps form widgets with lookup modifier dropdown
- FilterModifierMixin: Auto-enhances filterset fields with appropriate lookups
- Extended lookup support: Adds negation (n), regex, iregex, empty_true/false lookups
- Field-type-aware: CharField gets text lookups, IntegerField gets comparison operators, etc.

**Frontend:**
- TypeScript handler syncs modifier dropdown with URL parameters
- Dynamically updates form field names (serial → serial__ic) on modifier change
- Flexible-width modifier dropdowns with semantic CSS classes
2025-10-26 22:49:59 -05:00
Martin Hauser c5124cb2e4 feat(templates): Update user menu icon class names for consistency
Switch icons in the top-right User dropdown to Tabler’s
`dropdown-item-icon` to standardize spacing between the icon and label.
Improves readability and ensures alignment with the overall UI styling.

Fixes #20608
2025-10-21 08:35:50 -04:00
Jason Novinger d01d7b4156
Fixes #20551: Support quick-add form prefix in automatic slug generation (#20624)
* Fixes #20551: Support quick-add form prefix in automatic slug generation

The slug generation logic in `reslug.ts` looks for form fields using hard-coded ID selectors like `#id_slug` and `#id_name`. In quick-add modals, Django applies a `quickadd` prefix to form fields (introduced in #20542), resulting in IDs like `#id_quickadd-slug` and `#id_quickadd-name`. The logic couldn't find these prefixed fields, so automatic slug generation failed silently in quick-add modals. This fix updates the field selectors to try both unprefixed and prefixed patterns using the nullish coalescing operator (`??`), checking for the standard field ID first and falling back to the quickadd-prefixed ID if the standard one isn't found.

* Address PR feedback

The slug generation logic required updates to support form prefixes like `quickadd`. Python-side changes
ensure `SlugField.get_bound_field()` updates the `slug-source` attribute to include the form prefix when
present, so JavaScript receives the correct prefixed field ID. `SlugWidget.__init__()` now adds a
`slug-field` class to enable selector-based field discovery. On the frontend, `reslug.ts` now uses class
selectors (`button.reslug` and `input.slug-field`) instead of ID-based lookups, eliminating the need for
fallback logic. The template was updated to use `class="reslug"` instead of `id="reslug"` on the button to
avoid ID duplication issues.
2025-10-21 08:33:10 -04:00
github-actions 4db6123fb2 Update source translation strings 2025-10-21 05:03:30 +00:00
Jeremy Stretch 43648d629b
Fixes #20606: Enable copying text from badges in UI (#20633) 2025-10-20 17:12:42 -05:00
bctiemann 0b97df0984
Merge pull request #20625 from netbox-community/20498-url-custom-field-validation-regex
Fixes #20498: Apply validation regex to URL custom fields
2025-10-20 15:30:33 -04:00
Martin Hauser 5334c8143c
feat(forms): Add context handling for ModuleBay field (#20586) 2025-10-20 10:16:53 -07:00
Martin Hauser bbb330becf
feat(filtersets): Add `assigned` and `primary` filters for MACAddress (#20620)
Introduce Boolean filters `assigned` and `primary` to the MACAddress
filterset, improving filtering capabilities. Update forms, tables, and
GraphQL queries to incorporate the new filters. Add tests to validate
the correct functionality.

Fixes #20399
2025-10-20 10:01:25 -07:00
Jeremy Stretch e4c74ce6a3
Closes #20614: Update ruff for pre-commit check (#20631) 2025-10-20 09:07:12 -07:00
Martin Hauser a4868f894d feat(ipam): Add ContactsColumnMixin to ServiceTable
Enhance `ServiceTable` by incorporating `ContactsColumnMixin` for better
contact management. Updates the fields to include `contacts`.

Fixes #20567
2025-10-20 09:07:25 -04:00
github-actions 531ea34207 Update source translation strings 2025-10-20 05:03:22 +00:00
Jason Novinger 6747c82a1a Fixes #20498: Apply validation regex to URL custom fields
The validation_regex field was not being enforced for URL type custom
fields. This fix adds regex validation in two places:

1. to_form_field() - Applies regex validator to form fields (UI validation)
2. validate() - Applies regex check in model validation (API/programmatic)

Note: The original issue reported UI validation only, but this fix also
adds API validation for consistency with text field behavior and to
ensure data integrity across all entry points.
2025-10-19 18:30:54 -05:00
Martin Hauser e251ea10b5
Closes #20605: Document variable prefilling via URL parameters (#20619) 2025-10-19 15:42:09 -05:00
Martin Hauser a1aaf465ac
Fixes #20466: Correct handling of `assigned` filter logic (#20538) 2025-10-19 12:51:44 -05:00
Martin Hauser 2a1d315d85
Fixes #20524: Enhance API script scheduling validation (#20616) 2025-10-19 12:29:14 -05:00
github-actions 8cc6589a35 Update source translation strings 2025-10-16 05:03:49 +00:00
Jason Novinger bee0080917
Release v4.4.4 (#20594) 2025-10-15 14:25:43 -05:00
bctiemann 389c44e5d6
Merge pull request #20591 from pheus/20554-add-missing-contenttypefilter-to-filtersets
Fixes #20554: Add ContentTypeFilter to several filtersets
2025-10-15 14:16:51 -04:00
bctiemann 9cb2c78e34
Init storage at class level of BaseScript instead of in findsource function (#20575) 2025-10-15 11:09:22 -07:00
Jason Novinger 2ae98f0353 Fixes #20587: Handle stale ContentTypes in has_feature()
When deleting stale ContentTypes during remove_stale_contenttypes, the
pre_delete signal triggers notify_object_changed(), which calls
has_feature() with the ContentType instance. For stale types (those with
no corresponding model class), model_class() returns None, which then gets
passed to issubclass() in the feature test lambda, causing a TypeError.

The previous implementation in has_feature() checked for None before
attempting ObjectType lookup. The optimization in 5ceb6a6 removed this
safety check when refactoring the ContentType code path to use direct
feature registry lookups. This restores the null check to maintain the
original behavior of returning False for stale ContentTypes.
2025-10-15 14:09:04 -04:00
Jeremy Stretch addda0538f
Fixes #20584: Ensure consistent validation between Interface & InterfaceTemplate (#20589) 2025-10-15 11:04:39 -07:00
Jeremy Stretch c902a1c510
Fixes #20585: Fix AttributeError exception for conditionless single-field UniqueConstraints (#20590) 2025-10-15 12:51:33 -05:00
Martin Hauser f23ee0a46f
feat(filtersets): Add ContentTypeFilter to enhance filtering
Introduce `ContentTypeFilter` across several filtersets, including
`object_type`, `related_object_type`, `assigned_object_type`, and
`parent_object_type`. This improvement enhances filtering specificity
and aligns with existing usability standards.

Closes #20554
2025-10-15 18:24:42 +02:00
github-actions b4acc3fb36 Update source translation strings 2025-10-15 05:04:04 +00:00
Jeremy Stretch a69bbcf651 Release v4.4.3 2025-10-14 13:51:41 -04:00
Jeremy Stretch 2edfde5753
Fixes #19302: Fix uniqueness validation in REST API for nullable fields (#20549) 2025-10-14 09:19:10 -07:00
Martin Hauser cfbd9632ac feat(utilities): Add ranges_to_string_list
Introduce `ranges_to_string_list` for converting numeric ranges into a
list of readable strings. Update the `vid_ranges_list` property and
templates to use this method for better readability and maintainability.
Add related tests to ensure functionality.

Closes #20516
2025-10-14 09:39:09 -04:00
bctiemann c9386bc9c3
Merge pull request #20558 from netbox-community/20557-update-to-django-5.2.7
Closes #20557: Upgrade Django to v5.2.7
2025-10-13 07:02:44 -04:00
Jason Novinger c826c5cdb0 Closes #20557: Upgrade Django to v5.2.7
Upgrade Django to v5.2.7 to address upstream vulnerability reports

https://www.djangoproject.com/weblog/2025/oct/01/security-releases/
2025-10-13 01:06:23 -05:00
Aaron a4ab4f885d
Fixes #20156: Fixed rack view not using previous setting (#20556) 2025-10-13 00:38:45 -05:00
Arthur Hanson 61d77dff14
Fixes #19615: Properly set version request parameter for static files in S3 (#20455) 2025-10-12 18:49:42 -05:00
github-actions 24a83acc34 Update source translation strings 2025-10-10 05:03:50 +00:00
bctiemann dbc71158ec
Merge pull request #20525 from mathieumd/19818-hide_primary_ip_at_vm_creation
Fixes #19818: Hide IP fields when creating VM
2025-10-09 17:54:22 -04:00
Jason Novinger f0523611d1
Fixes #20542: Add form prefix to `POST` handler in `ObjectEditView` (#20550)
Commit d22246688 added form prefix support to the `GET` handler to fix
Markdown preview functionality in quick add modals. The form prefix
allows Django to properly namespace field names and IDs when rendering
forms within the quick add modal context.

However, the corresponding change was not made to the `POST` handler. This
created a mismatch where form fields were rendered with the `quickadd-`
prefix during `GET` requests, but the `POST` handler instantiated forms
without the prefix. When users submitted quick add forms, Django looked
for unprefixed field names like `address` and `status` in the `POST` data,
but the actual submitted data used prefixed names like `quickadd-address`
and `quickadd-status`. This caused validation to fail immediately with
"This field is required" errors for all required fields, making every
quick add form unusable.

The fix adds the same prefix detection logic to the `POST` handler that was
added to the `GET` handler, checking for the `_quickadd` parameter in the
query string and applying the `quickadd` prefix when present. This ensures
consistent form field naming between rendering and validation.

A regression test has been added to `MACAddressTestCase` to verify that MAC
addresses can be successfully created via the quick add modal, preventing
this issue from recurring. This test should be promoted to a template
test whenever it becomes possible to determine if a model should support
quick-add functionality.
2025-10-09 14:42:59 -07:00
Daniel Sheppard 7719b98697
Fixes #19825: Prevent inaccurate config revision activation when not intended (#20219) 2025-10-09 01:36:41 -05:00
Martin Hauser f383067ecb
Closes #20527: Address deprecation warnings (#20533) 2025-10-09 00:47:09 -05:00
github-actions 20de263565 Update source translation strings 2025-10-09 05:04:28 +00:00
Jeremy Stretch 5ceb6a60da Fixes #20290: Avoid exceptions when upgrading to v4.4 from early releases due to missing ObjectTypes table 2025-10-08 13:00:27 -04:00
Martin Hauser 33d4759871 feat(extras): Add range_contains ORM lookup
Introduce a generic lookup for ArrayField(RangeField) that matches rows
where a scalar value is contained by any range in the array
(e.g. VLANGroup.vid_ranges).
Replace the raw-SQL helper in the VLANGroup FilterSet (`contains_vid`)
with the ORM lookup for better maintainability.
Add tests for the lookup and the FilterSet behavior.

Closes #20497
2025-10-08 09:57:15 -04:00
Amir-Bakar 2abc5ac69a Update base.html
Update base.html to account for other cases where passwords are not used, other than LDAP. (SSO solutions, for example.)
2025-10-08 09:56:15 -04:00
bctiemann f8c074045f
Merge pull request #20528 from netbox-community/02496-max-page
20496 make max_page_size upper bound
2025-10-07 13:11:59 -04:00
Arthur 4db3d488ad Merge branch 'main' into 02496-max-page 2025-10-07 09:12:33 -07:00
Martin Hauser b7cae04572
fix(api): Update NumericRange handling to use half-open intervals (#20478) 2025-10-07 09:01:29 -07:00
Martin Hauser 51528ae429
fix(utilities): Enhance ranges_to_string for improved clarity (#20479) 2025-10-07 08:47:01 -07:00
Jeremy Stretch d5e8480367
Update OpenAPI schema (#20519) 2025-10-07 08:22:24 -07:00
Matthew Papaleo 05e26b82c1 Fixes #20507 Contacts returned for ASN via graphql API 2025-10-07 09:08:04 -04:00
Mathieu d8e4c95bcc Fixes #19818: Hide IP fields when creating VM 2025-10-07 14:03:01 +02:00
github-actions faa89a53ff Update source translation strings 2025-10-07 05:02:29 +00:00