Skip to content

Closes #17602: adds comments field to NestedGroupModel children #18859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 19, 2025

Conversation

jnovinger
Copy link
Member

@jnovinger jnovinger commented Mar 10, 2025

Fixes: #17602

  • Adds comments field to the following models, via their inheritance of netbox.models.NestedGroupModel:
    • dcim.Location
    • dcim.Region
    • dcim.SiteGroup
    • tenancy.ContactGroup
    • tenancy.TenantGroup
    • wireless.WirelessLANGroup
  • Hooks up the new comments field to all the required places

Review Notes

I tried to keep changes for each model to its own commit, to make review easier. However, there were a couple of commits that address things I missed.

@jnovinger jnovinger marked this pull request as draft March 10, 2025 19:58
@jnovinger jnovinger marked this pull request as ready for review March 11, 2025 17:06
@jnovinger jnovinger requested review from a team and bctiemann and removed request for a team March 11, 2025 17:07
…tions

Models affected:
- dcim: `Location`, `Region`, `SiteGroup`
- tenancy`: `ContactGroup`, `TenantGroup`
- wireless: `WirelessLANGroup`
- [x] 1. Add the field to the model class
- [x] 2. Generate and run database migrations
- [NA] 3. Add validation logic to clean()
- [NA] 4. Update relevant querysets
- [x] 5. Update API serializer
- [x] 6. Add fields to forms
    - [x] dcim.forms.model_forms.LocationForm, create/edit (e.g. model_forms.py)
    - [x] dcim.forms.buld_edit.LocationBulkEditForm, bulk edit
    - [x] dcim.dorms.bulk_import.LocationImportForm, CSV import
    - [x] filter (UI and API)
        - [NA] UI
            - Note: could not find any comments related things in filtersets
        - [x] API
- [x] 7. Extend object filter set
- [x] 8. Add column to object table
- [x] 9. Update the SearchIndex
- [x] 10. Update the UI templates
- [x] 11. Create/extend test cases
    - [NA] models
    - [x] views
    - [NA] forms
    - [x] filtersets
    - [x] api
- [NA] 12. Update the model's documentation
- [x] 1. Add the field to the model class
- [x] 2. Generate and run database migrations
- [NA] 3. Add validation logic to clean()
- [NA] 4. Update relevant querysets
- [x] 5. Update API serializer
- [ ] 6. Add fields to forms
    - [x] dcim.forms.model_forms.RegionForm, create/edit (e.g. model_forms.py)
    - [x] dcim.forms.buld_edit.RegionBulkEditForm, bulk edit
    - [x] dcim.dorms.bulk_import.RegionImportForm, CSV import
    - [NA] filter (UI and API)
- [x] 7. Extend object filter set
- [x] 8. Add column to object table
- [x] 9. Update the SearchIndex
- [x] 10. Update the UI templates
- [x] 11. Create/extend test cases
    - [NA] models
    - [x] views
    - [NA] forms
    - [x] filtersets
    - [x] api
- [NA] 12. Update the model's documentation
- [x] 1. Add the field to the model class
- [x] 2. Generate and run database migrations
- [NA] 3. Add validation logic to clean()
- [NA] 4. Update relevant querysets
- [x] 5. Update API serializer
- [x] 6. Add fields to forms
    - [x] dcim.forms.model_forms.LocationForm, create/edit (e.g. model_forms.py)
    - [x] dcim.forms.buld_edit.LocationBulkEditForm, bulk edit
    - [x] dcim.dorms.bulk_import.LocationImportForm, CSV import
    - [x] filter (UI and API)
- [x] 7. Extend object filter set
- [x] 8. Add column to object table
- [x] 9. Update the SearchIndex
- [x] 10. Update the UI templates
- [x] 11. Create/extend test cases
    - [NA] models
    - [x] views
    - [NA] forms
    - [x] filtersets
    - [x] api
- [x] 12. Update the model's documentation
- [x] 1. Add the field to the model class
- [x] 2. Generate and run database migrations
- [NA] 3. Add validation logic to clean()
- [NA] 4. Update relevant querysets
- [x] 5. Update API serializer
- [x] 6. Add fields to forms
    - [x] tenancy.forms.model_forms, create/edit (e.g. model_forms.py)
    - [x] tenancy.forms.buld_edit, bulk edit
    - [x] tenancy.dorms.bulk_import, CSV import
    - [NA] filter (UI and API)
- [x] 7. Extend object filter set
- [x] 8. Add column to object table
- [x] 9. Update the SearchIndex
- [x] 10. Update the UI templates
- [x] 11. Create/extend test cases
    - [NA] models
    - [x] views
    - [NA] forms
    - [x] filtersets
    - [x] api
- [NA] 12. Update the model's documentation
- [x] 1. Add the field to the model class
- [x] 2. Generate and run database migrations
- [NA] 3. Add validation logic to clean()
- [NA] 4. Update relevant querysets
- [x] 5. Update API serializer
- [x] 6. Add fields to forms
    - [x] tenancy.forms.model_forms, create/edit (e.g. model_forms.py)
    - [x] tenancy.forms.bulk_edit, bulk edit
    - [x] tenancy.forms.bulk_import, CSV import
    - [NA] filter (UI and API)
- [x] 7. Extend object filter set
- [x] 8. Add column to object table
- [x] 9. Update the SearchIndex
- [x] 10. Update the UI templates
- [x] 11. Create/extend test cases
    - [NA] models
    - [x] views
    - [NA] forms
    - [x] filtersets
    - [x] api
- [NA] 12. Update the model's documentation
- [x] 1. Add the field to the model class
- [x] 2. Generate and run database migrations
- [NA] 3. Add validation logic to clean()
- [NA] 4. Update relevant querysets
- [x] 5. Update API serializer
- [x] 6. Add fields to forms
    - [x] wireless.forms.model_forms, create/edit (e.g. model_forms.py)
    - [x] wireless.forms.bulk_edit, bulk edit
    - [x] wireless.forms.bulk_import, CSV import
    - [NA] filter (UI and API)
- [x] 7. Extend object filter set
- [NA] 8. Add column to object table (Note: was already present)
- [x] 9. Update the SearchIndex
- [x] 10. Update the UI templates
- [x] 11. Create/extend test cases
    - [NA] models
    - [x] views
    - [NA] forms
    - [x] filtersets
    - [x] api
- [NA] 12. Update the model's documentation
This can easily be extended (as in the case of LocationFilterSet) by
calling super() and ORing a filter to the queryset that is returned.
See: https://docs.djangoproject.com/en/5.1/ref/models/querysets/#or
@jnovinger jnovinger force-pushed the 17602-comments-field-for-nested-models branch from abbc677 to 06a206e Compare March 13, 2025 20:39
@jnovinger
Copy link
Member Author

Apologies for the force push, I wasn't thinking when I rebased this branch.

@jnovinger jnovinger requested a review from bctiemann March 13, 2025 20:40
@bctiemann bctiemann merged commit cd10087 into feature Mar 19, 2025
6 checks passed
@jnovinger jnovinger deleted the 17602-comments-field-for-nested-models branch March 21, 2025 21:53
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants