Adds Region.comments field in the required locations

- [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
This commit is contained in:
Jason Novinger
2025-03-10 17:07:59 -05:00
parent 2e2c815c91
commit 9a9d6cdedb
11 changed files with 48 additions and 16 deletions

View File

@@ -25,8 +25,10 @@ class RegionTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
# Create three Regions
regions = (
Region(name='Region 1', slug='region-1'),
Region(name='Region 2', slug='region-2'),
Region(name='Region 1', slug='region-1', comments=''),
Region(
name='Region 2', slug='region-2', comments="It's going to take a lot to drag me away from you"
),
Region(name='Region 3', slug='region-3'),
)
for region in regions:
@@ -40,13 +42,14 @@ class RegionTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
'parent': regions[2].pk,
'description': 'A new region',
'tags': [t.pk for t in tags],
'comments': 'This comment is really exciting!',
}
cls.csv_data = (
"name,slug,description",
"Region 4,region-4,Fourth region",
"Region 5,region-5,Fifth region",
"Region 6,region-6,Sixth region",
"name,slug,description,comments",
"Region 4,region-4,Fourth region,",
"Region 5,region-5,Fifth region,hi guys",
"Region 6,region-6,Sixth region,bye guys",
)
cls.csv_update_data = (
@@ -58,6 +61,7 @@ class RegionTestCase(ViewTestCases.OrganizationalObjectViewTestCase):
cls.bulk_edit_data = {
'description': 'New description',
'comments': 'This comment is super exciting!!!',
}