Commit Graph

70 Commits

Author SHA1 Message Date
Jeremy Stretch
aee02c168c Closes #15131: Dynamic queryset annotations for REST API endpoints (#15152)
* Introduce RelatedObjectCountField

* Introduce get_annotations_for_serializer() and enable dynamic annotations

* Add RelatedObjectCountFields to serializers; remove static annotations from querysets

* Remove annotations cleanup logic from BriefModeMixin

* Annotate type for RelatedObjectCountField

* Remove redundant field on TagSerializer

* Add missing reverse relationship for power feeds to rack

* Refactor RelatedObjectCountField to take a single relationship name
2024-02-15 14:49:27 -05:00
Jeremy Stretch
214c91a78e Closes #15087: Support for specifying a subset of API serializer fields (#15122)
* Enable dynamic field inclusion for REST API serializers

* Recurse through nested serializer when resolving prefetches

* Remove obsolete calls to prefetch_related() for API views

* Remove support for brief_prefetch_fields viewset attribute

* Rename query parameter

* Fixes #15133: Fix FHRP group representation on assignments endpoint under brief mode (#15134)

* Fixes #15133: Fix FHRP group representation on assignments endpoint under brief mode

* Update API test

* Restore get_queryset() on BriefModeMixin, minus prefetch logic

* get_prefetches_for_serializer() should reference serializer field source if set
2024-02-14 09:28:37 -05:00
Daniel Sheppard
1413e2f77d Closes: #9047 - Add Provider Accounts (#12057)
* #9047 - ProviderAccount

* #9047 - Move to new selector types

* #9047 - Re-introduce provider FK to Circuit model

* #9047 - Fix broken tests

* Misc cleanup

* Revert errant change

* Fix tests

* Update circuit filter form

---------

Co-authored-by: jeremystretch <jstretch@netboxlabs.com>
2023-03-29 08:27:11 -04:00
jeremystretch
67d537f036 Remove link peer fields from cable termination models 2022-06-01 16:48:56 -04:00
jeremystretch
7ca4b857be Closes #8496: Enable assigning multiple ASNs to a provider 2022-03-30 17:17:36 -04:00
jeremystretch
d9993c5b76 Move CustomFieldModelViewSet functionality into NetBoxModelViewSet 2022-03-09 11:44:55 -05:00
jeremystretch
b0621f7fca Refactor API views 2022-03-09 11:27:42 -05:00
jeremystretch
bfc52b15bb Add tags to organizational & nested group models 2021-10-21 10:51:02 -04:00
jeremystretch
431cb2a0ad Rename FilterSet modules 2021-04-29 16:48:24 -04:00
jeremystretch
073d9f19d2 Fixes #6267: Fix cable tracing API endpoint for circuit terminations 2021-04-26 16:49:52 -04:00
Jeremy Stretch
66a805bea8 Closes #6071: Cable traces now traverse circuits 2021-04-01 14:31:10 -04:00
Jeremy Stretch
ee7396481a Rename Cloud to ProviderNetwork 2021-04-01 10:21:41 -04:00
Jeremy Stretch
d45a4f5d12 Add termination FKs on Circuit model 2021-03-18 13:54:05 -04:00
Jeremy Stretch
2c42176154 Introduce the Cloud model 2021-03-18 11:20:09 -04:00
Jeremy Stretch
ec5da40a4a Add custom field support for organizational models to API serializers 2021-02-25 15:58:13 -05:00
Jeremy Stretch
1ffc5f32e4 Closes #5549: Eliminate extraneous database queries when using brief API calls 2020-12-29 11:41:44 -05:00
Jeremy Stretch
68eafb180a Rename get_subquery() to count_related() 2020-12-17 14:47:49 -05:00
Jeremy Stretch
cfbe7ec948 Call Coalesce() inside get_queryset() 2020-12-17 14:45:50 -05:00
Daniel Sheppard
b3999381f9 Fixes: #5450 - Added Coalesce to viewsets for the _count functions 2020-12-15 12:50:28 -06:00
Jeremy Stretch
84fe653306 Merge branch 'develop' into develop-2.10 2020-12-01 11:42:55 -05:00
Jeremy Stretch
0b8eb6e329 Closes #4865: Replace all Count() annotations with subqueries (#5385)
* Convert circuits to use subqueries

* Convert dcim to use subqueries

* Convert extras to use subqueries

* Convert ipam to use subqueries

* Convert secrets to use subqueries

* Convert virtualization to use subqueries

* Update global search view to use subqueries where appropriate

* Remove extraneous order_by() calls
2020-11-25 15:49:18 -05:00
Jeremy Stretch
219d07f997 Reorganize REST API components under netbox app 2020-10-13 15:57:21 -04:00
Jeremy Stretch
a52cf93b2f Add /trace API endpoints for CircuitTermination and PowerFeed 2020-10-08 13:55:29 -04:00
Jeremy Stretch
3fee32ef6e Prefetch path & destination for API views 2020-10-06 10:41:52 -04:00
Jeremy Stretch
865a2d5c77 Remove legacy connected endpoint fields 2020-10-05 09:56:46 -04:00
Jeremy Stretch
dd06bbcaf6 Closes #4349: Drop support for embedded graphs 2020-08-21 11:57:46 -04:00
Jeremy Stretch
61d2692029 Closes #4997: Introduce OrderedDefaultRouter; move root API views to views.py 2020-08-13 12:49:49 -04:00
Jeremy Stretch
05e7af702b Remove restriction enforcement from RestrictedQuerySet 2020-07-23 12:48:03 -04:00
Jeremy Stretch
43a4590014 Closes #4871: Specify ordering for querysets using annotate() to count related objects 2020-07-20 12:07:19 -04:00
Jeremy Stretch
9e4ba278fc Tweak querysets to work with restriction 2020-06-29 10:57:09 -04:00
Jeremy Stretch
487013fd25 Call restrict() when retrieving related Graphs 2020-06-29 10:14:43 -04:00
Jeremy Stretch
4bda842fae Remove FieldChoicesViewSet 2020-03-12 10:48:17 -04:00
Jeremy Stretch
0406c0c3eb #3338: Prefetch termination devices to avoid extra database queries 2020-01-27 17:22:31 -05:00
Saria Hajjar
c92bb4c1bf Fixes #3338: Added termination A and Z to the circuit 2020-01-27 21:53:10 +00:00
Jeremy Stretch
c19ad86328 Refactor FieldChoicesViewSet; add Interface.type to virtualization _choices endpoint 2020-01-15 09:59:44 -05:00
Jeremy Stretch
66632bd000 Renamed circuits FilterSets 2020-01-09 20:25:33 -05:00
Jeremy Stretch
ad9d33550f Closes #3731: Change Graph.type to a ContentType foreign key field 2019-12-06 10:32:59 -05:00
Jeremy Stretch
f426334c2e Closes #3485: Enable embedded graphs for devices 2019-09-18 15:59:52 -04:00
John Anderson
8bd1a48973 fixes #3428 - caching invalidation issues
Mitgate invalidation issues by using prefetch_related instead of select_related.
Also use invalidated_update instead of just update.
2019-08-19 01:53:39 -04:00
Jeremy Stretch
e8d09e97fa Added child counts to API serializers (WIP) 2019-04-12 17:07:56 -04:00
Jeremy Stretch
fe865b7d48 Closes #867: Add a 'description' field to CircuitTermination 2018-11-05 13:53:22 -05:00
Jeremy Stretch
9cad97b073 Upgraded django-filter to 2.0.0 2018-11-02 13:46:28 -04:00
Jeremy Stretch
7e828b7f2a Extended Cables to connect CircuitTerminations 2018-10-30 12:16:22 -04:00
Jeremy Stretch
66db32fefd Merged release v2.4.5 2018-10-03 11:23:21 -04:00
Jeremy Stretch
c48c3c9292 Closes #2438: API optimizations for tagged objects 2018-09-28 16:44:05 -04:00
Jeremy Stretch
68a5dcd47e Removed Python 2 string compatibility 2018-08-14 11:58:42 -04:00
Jeremy Stretch
4d92ffd153 Merge branch 'develop' into develop-2.4 2018-07-02 17:01:14 -04:00
Jeremy Stretch
6fe28e5047 Fixes #2191: Added missing static choices to circuits and DCIM API endpoints 2018-06-29 13:17:07 -04:00
Jeremy Stretch
999aebc167 Closes #2200: Replaced detail_route API view decorator with action (DRF change) 2018-06-29 11:48:21 -04:00
Jeremy Stretch
9a8f1c6672 Started merging writable serializers (WIP) 2018-04-04 17:01:24 -04:00