Open jeremystretch opened 1 year ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.
NetBox version
v3.5.3
Feature type
New functionality
Proposed functionality
Provide a mechanism to disable all write operations of a QuerySet, such that it can be considered safe to use within e.g. an export template. This proposal derived from discussion in #12204.
Per [my comment]() on that issue, a potential solution might be to effect a
read_only
attribute on the base QuerySet class. If true, any attempt to call a write method (e.g.update()
ordelete()
you raise an exception.Setting
read_only = True
on the queryset triggers an exception whenever a write-enabled method is called:Use case
Disabling potentially destructive methods on a queryset renders it safer to invoke within export templates and similar scenarios where user-provided code is being executed.
Database changes
No response
External dependencies
No response