We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 79d4a78 commit 92feb53Copy full SHA for 92feb53
django_petra/core.py
@@ -54,9 +54,14 @@ def bind_modules_urls():
54
if module_urls_path.exists():
55
# Construct the import path for the module's urls
56
module_urls = f'modules.{module_name}.urls'
57
+
58
+ # Import the module to get its version
59
+ urls_module = import_module(module_urls)
60
+ # Get version from module, default to 'v1' if not specified
61
+ version = getattr(urls_module, 'API_VERSION', 'v1')
62
63
# Append a path to urlpatterns, including the module's urls
- urlpatterns.append(path(f'api/v1/{module_name}/', include((module_urls, module_name))))
64
+ urlpatterns.append(path(f'api/{version}/{module_name}/', include((module_urls, module_name))))
65
66
# Return the urlpatterns list
67
return urlpatterns
0 commit comments