Views Module Structure
This directory contains the refactored views from the original monolithic views.py file.
File Organization
__init__.py
Central import file that exports all views for easy access. This allows other modules to import views using:
from mainapp.views import ObjItemListView, custom_logout
base.py
Basic views and utilities:
ActionsPageView- Displays the actions pagecustom_logout()- Custom logout function
objitem.py
ObjItem CRUD operations and related views:
ObjItemListView- List view with filtering and paginationObjItemFormView- Base class for create/update operationsObjItemCreateView- Create new ObjItemObjItemUpdateView- Update existing ObjItemObjItemDeleteView- Delete ObjItemObjItemDetailView- Read-only detail viewDeleteSelectedObjectsView- Bulk delete operation
data_import.py
Data import views for various formats:
AddSatellitesView- Add satellites to databaseAddTranspondersView- Upload and parse transponder data from XMLLoadExcelDataView- Load data from Excel filesLoadCsvDataView- Load data from CSV filesUploadVchLoadView- Upload VCH load data from HTMLLinkVchSigmaView- Link VCH data with Sigma parametersProcessKubsatView- Process Kubsat event data
api.py
API endpoints for AJAX requests:
GetLocationsView- Get locations by satellite ID in GeoJSON formatLyngsatDataAPIView- Get LyngSat source dataSigmaParameterDataAPIView- Get SigmaParameter dataSourceObjItemsAPIView- Get ObjItems related to a SourceLyngsatTaskStatusAPIView- Get Celery task status
lyngsat.py
LyngSat related views:
LinkLyngsatSourcesView- Link LyngSat sources to objectsFillLyngsatDataView- Fill data from Lyngsat websiteLyngsatTaskStatusView- Track Lyngsat data filling task statusClearLyngsatCacheView- Clear LyngSat cache
source.py
Source related views:
SourceListView- List view for Source objects with filtering
map.py
Map related views:
ShowMapView- Display objects on map (admin interface)ShowSelectedObjectsMapView- Display selected objects on mapClusterTestView- Test view for clustering functionality
Migration Notes
The original views.py has been renamed to views_old.py as a backup. All imports have been updated in:
dbapp/mainapp/urls.pydbapp/dbapp/urls.py
Benefits of This Structure
- Better Organization - Related views are grouped together
- Easier Maintenance - Smaller files are easier to navigate and modify
- Clear Responsibilities - Each file has a specific purpose
- Improved Testability - Easier to write focused unit tests
- Better Collaboration - Multiple developers can work on different files without conflicts