mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-18 17:16:26 +00:00
- Fix test user: set user_level=1 (STANDARD), REMOTE_ADDR="127.0.0.1" to
satisfy IsStandardUser + network_access_allowed checks; move user creation
to setUpTestData (1 DB write per class instead of per test)
- Fix parenthesis parser: group_result was computed then silently discarded;
rewrite parse_expression to recursively compose Q objects correctly so
queries like "(Newcastle OR NEW) AND (Villa OR AST)" work as documented
- Fix field selection performance: resolve allowed fields before serialization
and pass as context; get_channels/get_streams short-circuit when not requested
- Move import re to top of file; remove mid-file alias regex_module
- Convert ProgramSearchAPIView standalone APIView into @action(detail=False)
on ProgramViewSet so the router registers programs/search/ before
programs/{pk}/ automatically, eliminating the URL ordering dependency
- Scope permission to the action directly via permission_classes=[IsStandardUser]
rather than adding "search" to the global permission_classes_by_action dict
- Add test_title_parenthetical_grouping to cover the fixed parser path
- Tighten existing test assertions (case-insensitive, whole-word, description
AND, page_size cap) to catch regressions rather than passing vacuously
Co-authored-by: Copilot <copilot@github.com>
18 lines
726 B
Python
18 lines
726 B
Python
from django.urls import path, include
|
|
from rest_framework.routers import DefaultRouter
|
|
from .api_views import EPGSourceViewSet, ProgramViewSet, EPGGridAPIView, EPGImportAPIView, EPGDataViewSet, CurrentProgramsAPIView
|
|
|
|
app_name = 'epg'
|
|
|
|
router = DefaultRouter()
|
|
router.register(r'sources', EPGSourceViewSet, basename='epg-source')
|
|
router.register(r'programs', ProgramViewSet, basename='program')
|
|
router.register(r'epgdata', EPGDataViewSet, basename='epgdata')
|
|
|
|
urlpatterns = [
|
|
path('grid/', EPGGridAPIView.as_view(), name='epg_grid'),
|
|
path('import/', EPGImportAPIView.as_view(), name='epg_import'),
|
|
path('current-programs/', CurrentProgramsAPIView.as_view(), name='current_programs'),
|
|
]
|
|
|
|
urlpatterns += router.urls
|