Martin Hauser
ef52ac4203
chore(ruff): Enable RET rules and add explicit fallbacks
...
Adopt Ruff `RET` to improve return-flow consistency across the codebase.
Simplify control flow by removing redundant `else` blocks after
`return`, and add explicit `return None` (or equivalent) fallbacks
where appropriate to preserve existing behavior.
Fixes #21411
2026-02-18 16:49:36 -05:00
Martin Hauser
945e7ade0a
Fixes #21407 : Enable I (isort) and stabilize import ordering ( #21458 )
...
- Adopt Ruff `I` (isort) rules for consistent import sorting
- Add two `# isort: split` boundaries to keep required imports pinned
in `__init__.py` modules
2026-02-18 10:41:51 -06:00
Jason Novinger
d6b9d30086
Fixes #20442 : Mark template-accessible methods with alters_data=True ( #21431 )
...
Add alters_data=True to methods that modify database or filesystem state
and are accessible from Jinja2 sandbox template contexts:
- UserConfig.set(), clear(): Persist preference changes when commit=True
- ManagedFile.sync_data(): Writes files to scripts/reports storage
- ScriptModule.sync_classes(), sync_data(): Creates/deletes Script objects
- Job.start(), terminate(): Updates job status, creates notifications
Methods intentionally not protected:
- DataFile.refresh_from_disk(): Only modifies instance attributes in memory
- Overridden save()/delete(): Django's AltersData mixin auto-propagates
- Properties like Script.python_class: Not callable in template context
Ref: #20356 for exploit details demonstrating the vulnerability
2026-02-13 10:44:18 -08:00
Arthur
588c069ff1
#20378 fix delete of DataSource
2025-11-06 15:57:07 -08:00
Arthur
aac333a6d4
19381 fix data file script sync
2025-05-06 11:50:02 -07:00
Jeremy Stretch
67480dcf4f
Closes #18191 : Remove duplicate SQL indexes ( #19074 )
...
* Closes #18191 : Remove redundant SQL indexes
* Update developer documentation
* Add a system check for duplicate indexes
2025-04-03 15:16:57 -05:00
Arthur Hanson
1b4e00aeda
18896 Replace STORAGE_BACKEND with STORAGES and support Script running from S3 ( #18680 )
2025-03-17 07:36:34 -07:00
Jeremy Stretch
343a4af591
Closes #18022 : Extend linter (ruff) to enforce line length limit (120 chars) ( #18067 )
...
* Enable E501 rule
* Configure ruff formatter
* Reformat migration files to fix line length violations
* Fix various E501 errors
* Move table template code to template_code.py & ignore E501 errors
* Reformat raw SQL
2024-11-21 15:58:11 -05:00
Arthur Hanson
0cff4c9795
14799 Fix sync of scripts from data source ( #15303 )
...
* 14799 fix script creation from data-source
* 14799 dont cache module_scripts
* 14799 fix sync_classes call
2024-03-26 08:36:36 -04:00
Jeremy Stretch
b83fcc6077
Merge branch 'develop' into feature
2023-11-29 20:25:44 -05:00
Abhimanyu Saharan
290aae592d
Raises validation error if file path and root are not unique ( #14232 )
...
* raises validation error if file path and root are not unique #14187
* review changes #14187
2023-11-29 16:25:16 -05:00
Jeremy Stretch
8dcbd66de6
Closes #13427 : Public model registration ( #14152 )
...
* Initial work on #13427
* Clarify documentation
* Reference public models registry when populating models for ConfigTemplate context
2023-11-03 10:32:59 -04:00
Jeremy Stretch
caedc8dbe3
Closes #13352 : Translation support for model verbose names ( #13354 )
...
* Update verbose_name & verbose_name_plural Meta attributes on all models
* Alter makemigrations to ignore verbose_name & verbose_name_plural changes
2023-08-03 10:41:10 -04:00
Arthur Hanson
83bebc1bd2
Closes #13132 : Wrap verbose_name and other model text with gettext_lazy() (i18n)
...
---------
Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com >
2023-07-31 11:28:07 -04:00
Jeremy Stretch
f7a2eb8aef
Closes #11890 : Sync/upload reports & scripts ( #12059 )
...
* Initial work on #11890
* Consolidate get_scripts() and get_reports() functions
* Introduce proxy models for script & report modules
* Add add/delete views for reports & scripts
* Add deletion links for modules
* Enable resolving scripts/reports from module class
* Remove get_modules() utility function
* Show results in report/script lists
* Misc cleanup
* Fix file uploads
* Support automatic migration for submodules
* Fix module child ordering
* Template cleanup
* Remove ManagedFile views
* Move is_script(), is_report() into extras.utils
* Fix URLs for nested reports & scripts
* Misc cleanup
2023-03-24 21:00:36 -04:00