Skip to content

Commit 20a4334

Browse files
committed
- **Refactored URL definitions and view logic for consistency:**
- Updated `entity.py` to use `entity-dashboard-year` reverse URL instead of `entity-dashboard-month`, simplifying navigation URLs. - Consolidated multi-line `reverse()` calls into single-line definitions for readability in several locations. - **Improved imports and class definitions across views:** - Reorganized `ledger.py` imports for logical groupings and systematic readability. - Adjusted multi-line class definitions in `ledger.py` to a single-line format where appropriate, improving readability. - Reformatted classes like `FiscalYearLedgerModelCashFlowStatementView` and `FiscalYearLedgerIncomeStatementView` for consistency. - Removed redundant and excessive spacing between widget definitions and parameters. - **Optimized extra context definitions:** - Simplified `extra_context` definitions in views like `LedgerModelListView` and `ImportJobModelListView` to make them more concise. - **Enhanced form-level changes for better structure and clarity:** - Refactored `get_form()` calls in multiple views to bundle kwargs more cleanly. - Replaced redundant calls to multi-line dictionary configurations with unified patterns for better functionality. - **Enhancements in `data_import.py` for new reset and handling capabilities:** - Introduced `ImportJobModelResetView` to manage resets on import jobs, e.g., clearing matches and invalid imports. - Added detailed reset transaction logic, including children collapse and match clearing in bulk scenarios. - Updated `ImportJobDetailView` to show progress details, import actions, and contextual information like pending/ready counts. - **Additional refinements in staged transaction handling:** - Introduced `StagedTransactionUpdateView` for managing parent-child relationships, splits, and matches within staged transactions. - Enhanced validation logic for transaction forms, especially for `tx_import` and child transaction splits. ### **Summary** Refactored and cleaned up URL definitions, imports, and view logic for consistency and maintainability. Introduced advanced reset capabilities for import job workflows, optimized transaction states, and improved code readability. These changes support better scalability, clarity, and UX across ledger management and importing modules. ### **Backwards Compatibility** These changes are fully backwards compatible.
1 parent 7a88e74 commit 20a4334

File tree

6 files changed

+454
-174
lines changed

6 files changed

+454
-174
lines changed

django_ledger/urls/data_import.py

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,39 @@
33
from django_ledger import views
44

55
urlpatterns = [
6-
path('<slug:entity_slug>/jobs/',
7-
views.ImportJobModelListView.as_view(),
8-
name='data-import-jobs-list'),
9-
path('<slug:entity_slug>/jobs/<uuid:job_pk>/update/',
10-
views.ImportJobModelUpdateView.as_view(),
11-
name='data-import-jobs-update'),
12-
path('<slug:entity_slug>/jobs/<uuid:job_pk>/delete/',
13-
views.ImportJobModelDeleteView.as_view(),
14-
name='data-import-jobs-delete'),
15-
path('<slug:entity_slug>/import-ofx/',
16-
views.ImportJobModelCreateView.as_view(),
17-
name='data-import-ofx'),
18-
path('<slug:entity_slug>/jobs/<uuid:job_pk>/txs/',
19-
views.DataImportJobDetailView.as_view(),
20-
name='data-import-job-txs'),
21-
path('<slug:entity_slug>/jobs/<uuid:job_pk>/reset/',
22-
views.ImportJobModelResetView.as_view(),
23-
name='data-import-job-txs-undo'),
24-
path('<slug:entity_slug>/jobs/<uuid:job_pk>/txs/<uuid:staged_tx_pk>/undo/',
25-
views.StagedTransactionUndoView.as_view(),
26-
name='data-import-staged-tx-undo'),
6+
path('<slug:entity_slug>/jobs/', views.ImportJobModelListView.as_view(), name='import-job-list'),
7+
path(
8+
'<slug:entity_slug>/jobs/<uuid:job_pk>/detail/', views.ImportJobDetailView.as_view(), name='import-job-detail'
9+
),
10+
path(
11+
'<slug:entity_slug>/jobs/<uuid:job_pk>/update/',
12+
views.ImportJobModelUpdateView.as_view(),
13+
name='import-job-update',
14+
),
15+
path(
16+
'<slug:entity_slug>/jobs/<uuid:job_pk>/delete/',
17+
views.ImportJobModelDeleteView.as_view(),
18+
name='import-job-delete',
19+
),
20+
path('<slug:entity_slug>/import-ofx/', views.ImportJobModelCreateView.as_view(), name='data-import-ofx'),
21+
path(
22+
'<slug:entity_slug>/jobs/<uuid:job_pk>/reset/',
23+
views.ImportJobModelResetView.as_view(),
24+
name='data-import-job-txs-undo',
25+
),
26+
path(
27+
'<slug:entity_slug>/jobs/<uuid:job_pk>/txs/<uuid:staged_tx_pk>/update/',
28+
views.StagedTransactionUpdateView.as_view(),
29+
name='data-import-staged-tx-update',
30+
),
31+
path(
32+
'<slug:entity_slug>/jobs/<uuid:job_pk>/txs/<uuid:staged_tx_pk>/undo/',
33+
views.StagedTransactionUndoView.as_view(),
34+
name='data-import-staged-tx-undo',
35+
),
36+
path(
37+
'<slug:entity_slug>/jobs/<uuid:job_pk>/txs/<uuid:staged_tx_pk>/unmatch/',
38+
views.StagedTransactionUnmatchView.as_view(),
39+
name='data-import-staged-tx-unmatch',
40+
),
2741
]

0 commit comments

Comments
 (0)