refactor(product_type): Extra ProductType models into dojo/product_type/ module [1/10]#14970
Draft
valentijnscholten wants to merge 9 commits into
Draft
refactor(product_type): Extra ProductType models into dojo/product_type/ module [1/10]#14970valentijnscholten wants to merge 9 commits into
valentijnscholten wants to merge 9 commits into
Conversation
…type/
Phase 1 of module reorg per AGENTS.md. Move Product_Type class + admin
registration into dojo/product_type/{models,admin}.py with backward-compat
re-export in dojo/models.py. No migration change (app_label unchanged).
…/ui/ [Phase 3,4] Phase 3+4 of module reorg per AGENTS.md. Move Product_TypeForm, Delete_Product_TypeForm, Add_Product_Type_AuthorizedUsersForm into ui/forms.py (re-export from dojo/forms.py) and ProductTypeFilter into ui/filters.py. The filter keeps its DojoFilter base; its only consumer is the product_type view, so no dojo/filters.py re-export is kept (matches the url module) — avoids the extracted-filter<->dojo.filters circular import.
… [Phase 5] Phase 5 of module reorg per AGENTS.md. Move dojo/product_type/views.py to dojo/product_type/ui/views.py and update its two importers (dojo/organization/urls.py and the counts unit test). product_type has no urls.py (routes live in dojo/organization/urls.py), so only the views move.
… [Phase 6,8,9] Phase 6/8/9 of module reorg per AGENTS.md (Phase 7 N/A - no product_type API filter). Move ProductTypeSerializer into api/serializer.py (re-exported from api_v2/serializers.py, still used by ReportGenerateSerializer) and ProductTypeViewSet into api/views.py. Add api/urls.py with add_product_type_urls() preserving route 'product_types' + basename 'product_type'; wire it into dojo/urls.py. Viewset re-export omitted (would cycle api_v2.views<->product_type.api.views; only consumer was a test, now imports new path).
Update AGENTS.md with conventions learned doing the Phase 1 model extractions: string FK refs to break circular imports, ruff noqa conventions (PLC0415/E402/F401), consolidated re-export placement, single-sourced constants, load-bearing side-effect imports, and corrected docker-based verify commands (manage.py shell, run-unittest.sh).
This was referenced Jun 7, 2026
Conditional services phase; keep filter base class + drop re-export when sole consumer is the module's own view (circular-import fix); per-symbol re-export decisions by actual consumers (incl. multi-line imports); preserve DRF route+basename; run real tests after dropping a re-export.
…sons from engagement reorg
…le-break (Phase 6)
Self-contained brief for finishing the reorg: 5 new draft PRs (#6-10) stacked on top of the finding PR, plus CWE+BurpRawRequestResponse folded into the existing finding module PR. Bundles, line ranges, stack/cascade mechanics, and module-specific gotchas. Marks the 5 core modules Complete.
This was referenced Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked PRs
This is one of a stacked series that reorganizes
dojo/into self-containeddojo/{module}/packages (matching thedojo/url/reference). They are stacked — each PR is based on the previous one — so review and merge bottom-up in this order:Merge #14970 first; each following branch is rebased onto the updated base and merged in turn. PRs 6–10 (draft, head branches on the DefectDojo upstream repo) continue the stack on top of #14974 — full implementation brief is the Phase 10 section in
AGENTS.md.Summary
Fully reorganizes the Product Type domain into a self-contained
dojo/product_type/module — the first complete worked example across all layers.Product_Type+ admin moved intodojo/product_type/{models,admin}.py; backward-compat re-export indojo/models.py. No migration change.ui/forms.py(re-exported fromdojo/forms.py);ProductTypeFilter→ui/filters.py(keepsDojoFilterbase; nodojo/filters.pyre-export needed since its only consumer is the product_type view — avoids a circular import); views →ui/views.py,dojo/organization/urls.pyupdated.ProductTypeSerializer→api/serializer.py(re-exported, still used byReportGenerateSerializer);ProductTypeViewSet→api/views.py;api/urls.pyaddsadd_product_type_urls()preserving routeproduct_types+ basenameproduct_type.url/locationreference modules).AGENTS.md.Backward-compat re-exports keep all existing consumers working unchanged.